Using PyObjC for Developing Cocoa Applications with Python
While Cocoa applications are generally written in Objective-C, Python is a fully capable choice for application development. Python is an interpreted, interactive and object-oriented programming language, that provides higher-level features such as regular expressions and garbage collection, and it's built into Mac OS X Tiger. Best of all, there's little you need to sacrifice in order to gain Python's flexibility and productivity, which are making this language increasingly popular. With Python, you still leverage the complete power and maturity of Cocoa, the capable project management of Xcode and the rapid interface development offered by Interface Builder. Today, you can build native, uncompromising, best-of-breed Mac OS X applications using only Python.
Python stands alone from Cocoa, as does Cocoa from Python. Between the two systems, enabling interoperability, stands PyObjC, the Python/Objective-C bridge.
PyObjC (pronounced pie-obz-see) is the key piece which makes it possible to write Cocoa applications in Python. It enables Python objects to message Objective-C objects as if they're fellow Python objects, and likewise facilitates Objective-C objects to message Python objects as brethren.
In this article, we'll touch on Cocoa bridges and Python in general, and discuss some of the factors to consider before choosing this option. Then we'll explain where to get PyObjC and how to install it. Finally, you'll learn how to write a Cocoa application in Python by building a simple application from start to finish. A trio of QuickTime movies are included which demonstrate using Interface Builder to accomplish this task.