[Pythonmac-SIG] Cocoa apps in Python?
Just van Rossum
just@letterror.com
Wed, 19 Feb 2003 22:41:21 +0100
Danny Yoo wrote:
> Has anyone written any more tutorials on PyObjC? The only one I've
> seen so far is on Oreilly's macdevcenter.com:
>
> http://www.macdevcenter.com/pub/a/mac/2003/01/31/pyobjc_one.html
>
> I'm just curious if there's a gentler introduction, or if PyObjC is a
> fast-moving target that introductions are still bound to be outdated
> in weeks?
It's moving, but slowing down. Your best bet is to check out the PyObjC
examples, and learn how to translate ObjC method syntax to Python:
[obj foo:x bar:y]
translates to
obj.foo_bar_(x, y) # note the funny underscores
The canonical way to spell the ObjC method signature is
foo:bar:
Replacing every : with an _ gets you the Python method name. Methods
without arguments don't get funny underscores: [app delegate] becomes
app.delegate().
Once you're familiar with this you should be able to use any Cocoa
tutorial that uses Objective-C. Also check the pyobjc-dev mailing list
archives, there have been other examples posted.
Just