[Pyobjc-dev] Explicit conversion from ObjC to PyObject?
Brought to you by:
ronaldoussoren
From: Greg A. <ga...@ap...> - 2009-07-28 05:45:50
|
Hi, Is it feasible to mix the "old-fashioned" Python C API with PyObjC? Specifically, I'm exposing some C++ classes to Python using PyType_Ready and all of that, but some of those methods are actually Objective-C++ code and return Objective C instances such as NSColor. I could manually wrap them too, but that seems wasteful considering all the excellent work that's gone into creating PyObjC. Is there a way to explicitly ask PyObjC to wrap an Objective C object and turn it into a PyObject* proxy that I can return to the Python interpreter? All the PyObjC examples that I've found so far assume that you're not using any other low-level interface, and so everything is magically wrapped & unwrapped whenever it crosses the Python<->ObjC boundary. But what if I want to participate in that boundary manually? Is there a "PyObject * convertObjCToPython(id)" function that I can call? (Or convertPythonToObjC, for that matter?) Thanks very much in advance for any insights. -greg abbas. |