On 8 okt 2003, at 6:57, Stéphane Jolicoeur-Fidelia wrote: > Hi, > I have a quick question about pyobjc: I am trying to build examples > from a Cocoa programming book with pyobjc(i installed the latest > version and am working from Project builder). I created a document > based application and then proceeded to create MyDocument.h and > MyDocument.m . My question is if I actually implement some methods in > pure ObjC will the MyDocument.py be able to see them and be able to > use them as is like any object method ? or will I just create useless > files in my project? (or maybe i should ask how do i create a python > object that is callable from objc? (I have seen mention of building > partial Cocoa-Python apps,) Which would mean having MyDocument.h and > .m import say MyPython.py as a lib or object ). > > Dazed and Confused I don't fully understand what your trying to do, but the most direct answer is 'no you cannot implement some methods of a class in python and others in Objective-C'. Why do you want to do that in the first place? If you really want to include pure ObjC classes in your project you can use the Cocoa-Python-ObjC template. Calling python methods from ObjC is easy enough if you use the right naming convention on the python side: Python: def myMethodWithArg_andArg_(self, arg1, arg2): print arg1, arg2 return 44 Objective-C: id result, arg1, arg2; result = [obj myMethodWithArg:arg1 andArg:arg2]; But as I wrote before: try to convert the entire example to Python, that makes your live much easier. And read the tutorials. Ronald
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4