Re: [Pyobjc-dev] Using Python from ObjC tutorial - Need help
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-06-17 05:21:37
|
On Tuesday, Jun 17, 2003, at 00:03 Europe/Amsterdam, Jack Jansen wrote: > > On maandag, jun 16, 2003, at 17:02 Europe/Amsterdam, Ronald Oussoren > wrote: >>> I haven't a clue how to modify an existing ObjC project to allow >>> inclusion of Python code, and this isn't documented anywhere. For >>> new projects there's the Cocoa-Python-ObjC Application.pbproj >>> template which is a start, but this isn't what I want, I want to add >>> Python functionality to an existing project. It is a good idea to >>> document this anyway, methinks, as it will hopefully also contain >>> the knowledge that went into creation of the templates in the first >>> >> place. >> >> Is the "existing project" something you have the sources for or do >> you want to write a plugin? > > The former. I want to write a tutorial that lets people start with an > existing Apple example (/Developer/Examples/AppKit/SimpleComboBox) and > use Python to extend that app in a way that would be more difficult in > ObjC. That's a great idea, and not something we support at the moment. I don't think you can do this without building your own copy of python because Apple's python doesn't include a (shared) library. To get this to work you'll have to add some C code to your ObjC project that will initialize the python interpreter, and possibly load a startup python-script, before starting the ObjC runloop. Then look in one of the existing templates to see how they copy python files into the app bundle. Ronald |