Re: [Pyobjc-dev] Looking for example demonstrating calling python from Objective-C
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2018-12-05 12:17:32
|
The closest thing to documentation about this is: https://pyobjc.readthedocs.io/en/latest/tutorials/embedded.html <https://pyobjc.readthedocs.io/en/latest/tutorials/embedded.html>, but that document is very old and is probably out of date. The reason for the lack of documentation is that almost all users for PyObjC use it to write Python code that use the Apple ObjC frameworks. In the end the basic idea is: * Create a Python subclass of NSObject with methods that you want to call from from ObjC (make sure you use the right naming convention for those methods) * In ObjC create an @interface definition with the methods you want to call in ObjC * Create the Python object in Python and pass it to the ObjC code in some way * Call methods as normal in ObjC Ronald P.S. Sorry about the late response, I’ve been traveling and couldn’t approve your message to the list earlier. > On 19 Nov 2018, at 17:29, Dmitry Wolf <dii...@gm...> wrote: > > I'm trying to figure out how to call python from cocoa/objective-c code, but haven't found any example code that actually works. There seem to be all sorts of examples of pure python calling into frameworks and objective-c code, but nothing showing how to set up calls from a standard objective-c app into python. > > Actually I just copy pasted this question from 2006 thread https://sourceforge.net/p/pyobjc/mailman/message/11676132/ <https://sourceforge.net/p/pyobjc/mailman/message/11676132/> > Because I have exactly this question :D > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |