[Pythonmac-SIG] Pyobjc python in objc

Bob Ippolito bob at redivi.com
Wed Jul 5 06:08:00 CEST 2006


On Jul 4, 2006, at 8:42 PM, Jonathan wrote:

> How does one let objc know about a python class' methods, etc.  
> without using a nib file?
>
> I've gotten to the point where I can build a bundle that includes a  
> python class subclassing NSObject, but objective-c won't run any  
> methods (other than init).  I'm guessing the tutorial that mentions  
> adding outlets and actions in a nib file adds them so that objc  
> knows that they're there. (?)
>
> The bundle loads and running NSLog(dir(theObject)) on the python  
> side lists the method I'm trying to call from objc...  so I could  
> easily be doing something wrong... again.  :)

Normally this is done by writing the abstract base class in Objective- 
C and subclassing it from Python. You can also do it by adding a  
category on NSObject. It's not possible to otherwise describe a class  
in Objective-C that isn't available at link time, because you'll get  
a linker error.

-bob




More information about the Pythonmac-SIG mailing list