From: Ronald Oussoren <ronaldoussoren@ma...> - 2007-09-14 15:04:45
On Friday, September 14, 2007, at 04:58PM, "Scott Herzinger" <scotthz@...> wrote:
>I've got another
>twist on this that I could really use help with. I need to extend a Cocoa app using Python. The twist is that I can't rebuild the Cocoa app, but I can add plug-ins written in ObjC. I've implemented such a plug-in, and I'm at the point where I can run Python code using, for example, PyRun_String.
If the application has an ObjC interface that plugins must implement (or a class that you must subclass) you can do that using PyObjC. There's several examples of that in PyObjC's source tree. Two important classes of that are screensavers and prefpanes for System Preferences.
That way you don't have to use Python's C API yourself.