Posts Tagged: embedding

Adventures in Embedding Python on OS X – Part 1.5

So why part 1.5?  Cause I’m not really starting at the beginning.    I’ll write more later, but here is one way of embedding Python in an Objective-C application, getting access to the app’s objects from Python, and one way to pass ivars over to Python, using a Singleton to manage a pool of objects.

The example is not complete, and not without it’s problems in terms of design, and so on.  There are other ways to do this as well, for example using notifications, or perhaps bindings.   So your mileage may vary, but I hope it helps some people who have been asking about this lately. I have several other Python/ObjC embedding samples that I can share as well, and will endeavor to do so when I have time.

Here’s the source code (Xcode project, OS X 10.5.x, links to system python):
PythonEmbedExample-ObjectPool