Re: [Pyobjc-dev] Python subclasses of NSView?
Brought to you by:
ronaldoussoren
From: Dinu G. <gh...@da...> - 2003-01-08 13:37:44
|
Dinu Gherman wrote: > I'm trying to find out if it is possible to have Python subclasses > of graphic widgets like NSView, say? I can't quite figure out how > to tell IB about a new Python file containing the subclass and then > change a "custom view" widget to be of the new class, MyView, say. You can! ;-) > With Obj-C you tell IB by making it read the MyView.h file, and > then you can switch a custom view from the container views palette > to the new MyView class. How would I do this for a Python subclass? You need to: 1. subclass NSView in the Classes tab of the NIB file window in IB to MyView, say 2. drag a custom view from the container views palette on some window 3. select the custom view and type Cmd-5 to change its class to MyView 4. add Python code for MyView somewhere, inheriting from AutoBaseClass, not NSView! 5. implement relevant methods for MyView like drawRect! Excellent! Will be fun to extend this to mouse handling and dragging operations...! ;-) Dinu -- Dinu C. Gherman ...................................................................... "Any sufficiently advanced technology is indistinguishable from magic." (Arthur C. Clarke) |