Creating a User Interface with MacPython
There are a number of packages that allow creation of a user interface
for your Python code, each of which has its own merits:
- The Carbon package gives low-level access to the old Macintosh toolbox
calls for windows, events, dialogs and more. The FrameWork module
wraps these in a minimal framework. For documentation see the Macintosh
Library section of the Python Language and runtime
documentation and the Human Interface Toolbox section of
Apple's Carbon Documentation.
This solution is compatible with MacPython-OS9.
- The W framework is built on top of this, and easier to use.
The MacPython IDE uses W. Some documentation is available on
Corran Webster's website.
Compatible with MacPython-OS9.
For new work, however, one of the following packages may be better suited.
They may be available out of the box in this distribution, otherwise you
can install them through the Package Manager:
- PyObjC allows complete access to Cocoa.
In technical terms it is a
bidirectional bridge between Python and Objectve-C, similar to Apple's Java
bridge. Probably the best choice for Mac OS X-only applications, but at the
time of this writing PyObjC is still in beta.
- wxPython gives Python programs
access to the wxWindows GUI toolkit. Many people consider this
the best open source cross-platform GUI solution available today.
- Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python
to Tcl/Tk. If you install AquaTk it creates a native user interface on Mac OS X.
Documented in the Library section, Tkinter subsection of the
Python Language and runtime documentation. Tkinter
is not available for MacPython-OS9.