[Pythonmac-SIG] PyObjC - custom view

Ronald Oussoren oussoren at cistron.nl
Fri Jun 13 08:49:02 EDT 2003


On Friday, Jun 13, 2003, at 06:25 Europe/Amsterdam, Dan Grassi wrote:

> I am trying to use PyObjC to create an application that needs a custom 
> view.  In ObjC in PB I create a class inheriting from NSView and a 
> CustomView in a window specifing the class as the custom class and 
> create a class of the same name in ObjC also inheriting from NSView.  
> But I can't figure out how to create the class in PyObjC and get it to 
> be used by the CustomView.

Just define the class as a subclass of NSView and make sure that the 
module containing the class is loaded before you load the NIB. When you 
create a class in IB you don't really create the class, you just tell 
IB that you will define a class in your own code.

The DotView example that was recently added to the PyObjC CVS is an 
example on how to do this.

Ronald




More information about the Pythonmac-SIG mailing list