[Pyobjc-dev] Passing ObjectiveC pointers to PyObjC
Brought to you by:
ronaldoussoren
|
From: James T. <tra...@gm...> - 2008-02-19 09:32:42
|
Hello,
I'm trying to augment my existing ObjectiveC application with some
embedded Python. I've got an embedded Python interpreter that can run
PyObjC, but what I would like to do is the following:
In my ObjectiveC application, I'd like to get a pointer to an object
(an NSString, for example):
NSString *tmpStr = [NSString stringWithString:@"Test"];
Then, I would like to pass this NSString pointer to a Python function,
so that I can use PyObjC to operate on the object in the normal PyObjC
fashion:
def handler(s):
print "The length of the string is ", s.length()
I would try to call the Python handler() procedure like so:
PyObject* arg; // tmpStr
PyObject* method; // "handler"
PyObject_CallMethodObjArgs(_self , method, arg, NULL);
I don't know how to go about obtaining PyObject*s from the ObjectiveC types...
Is this even possible?
Thanks.
-jim t
|