Building Cocoa GUIs in Python with PyObjC, Part Three
Writing A Python Controller
First let's add your new controller into the GUI. Add an object from "Objects & Controllers" into your GUI. Now click on it and bring up the "Identity" tab in the inspector. The first drop-down lets you select a class, find "controller" and pick it.
Now Open up your newly created controller.py with your favorite text editor, and we'll begin.
#
# controller.py
# QuickTag
#
# Created by Scott Paul Robertson on 6/11/08.
# Copyright (c) 2008 __MyCompanyName__. All rights reserved.
#
from objc import YES, NO, IBAction, IBOutlet
from Foundation import *
from AppKit import *
class controller(NSWindowController):
pass
There are two parts we will be adding, the Outlets (variables) and Actions (methods). first lets add a few outlets to the class controller.
name = IBOutlet()
artist = IBOutlet()
albumArtist = IBOutlet()
album = IBOutlet()
...
These class variables can now be connected to various fields in your GUI. In Interface Builder ...

