[Pyobjc-dev] Embedding Python in an ObjC application
Brought to you by:
ronaldoussoren
From: Dan G. <da...@le...> - 2004-06-14 20:27:15
|
Hi, I want to use python from a Cocoa application other than as a class in a .nib file. I have this working somewhat but there are a couple of problems: 1) I need to run on 10.2.x and above but PyObjC is not not included in 10.2.x. Thus I would like to embed the Python framework in my application. 2) While my example runs with ZeroLink enabled I get a linker error with ZeroLink disabled: ld: Undefined symbols: .objc_class_name_TestPy I use the basic files from the SimpleConboBoxPlus example: PythonGlue.h PythonGlue.m PythonGlue.py I added to the top of main() in main.m: NSAutoreleasePool* pythonAutoreleasePool = [[NSAutoreleasePool alloc] init]; [[PythonGlue alloc] init]; I added the following resource file TestPy.py: from Foundation import * class TestPy(NSObject): def test(self): print "TestPy:test" In my application I added: [[[TestPy alloc] init] test]; Any help and comments will be appreciated. Dan |