If you fire up “xcode”, you get the option to create a python cocoa project. This sets up a basic structure for your Mac python application. Inside xcode, you can draw the user interface in the “Interface Builder” with input fields, labels, buttons and so on.
OSX uses a model/view/controller (MVC) architecture for the applications, so you need to write a controller now to react to events in your fresh user interface. The controller is a python file. You normally have placeholders for the events and actions and link them with xcode (drag/drop) to the user interface, though you also can do it with python.
In case you wonder about all the prefixed names (NSSomething, NSAnother, IBSomething): objective-C doesn’t have namespaces like python, so everything needs a prefix (NS for NextStep, IB for interface builder, etc.)
When you do this, you program with Cocoa. Cocoa is build with objective-C. Objective-C is open, but it is basically useless without Cocoa. Cocoa is a set of classes to create OSX (and iphone) programs. Strong MVC support. There are lots of libraries (webkit and so).
PyObjC is a bridge that allows you to interact with Cocoa classes. Three warnings:
Your python NSObject subclasses must adhere to Cocoa conventions as they’re just proxied objects. This means that they’re not really pythonic. You simply have to follow the cocoa conventions. The good news is that after a while you get used to it. A handy feature (as objective-C uses getters and setters methods that don’t look that well in python) is the key/value support which translates pretty well to python properties (so something that calls a getter/setter behind the scenes).
Conclusion: it is not as easy as you’d ideally want. But it is straightforward once you get used to it. And, to repeat, you need to learn Cocoa and objective-C anyway. It is possible to write a nicer wrapper, such as Ruby has apparently done. But it takes a lot of work. And there’s something to be said for the current straightforward system.
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):