Re: [Pyobjc-dev] Is this real?
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-05-23 07:35:52
|
On May 23, 2004, at 2:22 AM, James Stroud wrote: > Great. I've downloaded pyobjc latest. Installed. Started a python > application in xcode. It runs. I've read many tutorials and still have > no idea what is going on. I just want to use my python classes in > cocoa. Is this possible? By "PyObjC latest" do you mean the last release, or CVS? CVS has a large number of fixes and some new features.. we're going to have another release as soon as we iron out some Jaguar incompatibilities, and perhaps make some GNUStep related fixes. It may be the case that the tutorial is out of date, I don't really have time to run through it though. Jack or Ronald would probably be more helpful, I only have experience using ObjC from Python, not vice versa. > Where should I start in proving I've RTFM? How about this: > > % cp -R src/PythonGlue.* simpleComboBoxPlus > > Where is "src"? Search on google for "PythonGlue.h" yields no clue as > to its contents. Search on my hard drive yields no result. I find the > whole of pyobjc documentation this confusing. Not criticizing, I know > its a lot of work and few people. I just wasn't born knowing this > stuff. [crack:~/src/pyobjc] bob% find . -name "PythonGlue.*" ./Doc/tutorial_embed/src/PythonGlue.h ./Doc/tutorial_embed/src/PythonGlue.m ./Doc/tutorial_embed/src/PythonGlue.py That's from CVS, I have no idea what the "pyobjc latest" you installed contains or where you looked. > What do I do to get my ObjC classes to see my python classes or my > python classes to see MY ObjC classes (former better, but either > good)? > > Shouldn't it be (almost) as simple as: > > #include "somefile" I can't imagine it will be that simple any time soon, it would be hard to generate Objective C header files from arbitrary Python source code. > or > > import somemodule Using ObjC classes from Python is pretty easy.. either create a module and use objc.loadBundle(...), or if you just need a reference to a class that is already linked in then you can do objc.lookUpClass(...). Both are used all over the place in PyObjC's source code, though I did change the semantics of loadBundle slightly today. Unfortunately, I'm pretty busy and don't have time to write up any examples or go through the documentation and fix things.. so I hope this helped. -bob |