Re: [Pyobjc-dev] Importing custom Objc libraries/frameworks
Brought to you by:
ronaldoussoren
|
From: <bb...@ma...> - 2002-10-27 18:51:05
|
Sebastian,
The Web Services Tool example project contains everything within it=20=
to support automatic linking of frameworks into the Python runtime as=20
the app starts up.
Once you create a new Cocoa-Python project, add a framework target=20=
to the project. Put only classes that you want compiled into that=20
target. Then, in the app target, add a "Copy files" build phase and=20
copy the built framework into the "Frameworks" subdirectory of the=20
application (it is an option in the pop-up for the build phase=20
inspector).
If you have everything set up correctly, the framework will be=20
dynamically loaded automatically by the code in Main.py. If you add an=20=
Init.py python scripts as a Resource in the framework target, it will=20
be automatically evaluated immediately after the framework is=20
dynamically loaded. This allows you to import any other python code=20
that you might need (the framework's Resources directory is=20
automatically added to Python's sys.path).
Unfortunately, the Cocoa-Python project template does not currently=20=
include the correct code. When you create a new Cocoa-Python project,=20=
simply replace the contents of the main.m and the Main.py file with the=20=
contents from the same files in the Web Services Tool project.
I hope to have a chance to make a real tutorial out of this stuff,=20=
that and write some documentation....
b.bum
On Saturday, October 26, 2002, at 05:18 AM, S=E9bastien Pierre wrote:
> Hi,
>
> I am writing an Objective-C library that I'd like to import and use in=20=
> Python through pyobjc.
>
> Is it possible to do this? If so, what do I have to do to make my=20
> library available to python ?
>
> TIA,
>
> -- S=E9bastien
|