Living Code

Tags: PyObjC Cocoa Example Code Tutorial Renaissance

Nov 3, 2004 • 1 min read

A New Renaissance

Yesterday I laid out the issues I have with using Interface Builder to create Cocoa applications (whether in Objective-C or Python), and my requirements for a replacement. To sum up, here are the requirements again:

As I hinted at previously, I think I’ve found the tool I was looking for in GNUstep Renaissance, and as an added bonus, it can be used to create applications for Linux, unix, and Windows using the GNUstep framework. So although I’m interested mainly in building applications for OS X, there is still a chance for cross-platform compatibility.

So what does Renaissance look like? It’s and XML format, similar to HTML and Mozilla XUL (but simpler than XUL). Today I will cover how to install Renaissance and set it up to use from PyObjC.

Prerequisites (this is my setup, others may work, but I haven’t tested them).

  1. A Mac
  2. OS X (10.3)
  3. PyObjC (1.1), available from http://pyobjc.sourceforge.net/
  4. py2app (0.1.4), available from http://pythonmac.org/wiki/py2app (we’ll use this to build our double-clickable applications)
  5. Renaissance framework (0.8), available from http://www.gnustep.it/Renaissance/Download.html (this is the secret sauce)

Once you have the prerequisites installed, you need to make Renaissance available from Python. In your site-packages directory (on my machine this is /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages) add a Renaissance directory containing the following file:

__init__.py

import objc, AppKit, Foundation
objc.loadBundle('Renaissance', globals(),
    bundle_path='/Library/Frameworks/Renaissance.framework')
del objc, AppKit, Foundation

Well, that was easy enough. Next up, a Hello World application.

Post by: Dethe Elza 💜