Boudewijn Rempt
|
Gui Toolkit | Windows | Unix/X11 | MacOS | Notes |
---|---|---|---|---|
Tkinter | Yes | Yes | Yes, mostly | Tkinter is the most ancient Python GUI toolkit. It is based on tcl/tk, and has neither the real platform UI look and feel, nor a real Python programming style. A good resource is John Grayson's book, Python and Tkinter programming. |
PyQt | Yes | Yes | OS X only | PyQt is based on Qt, the cross-platform GUI toolkit by Troll Tech. It's also, not so coincidentally, the subject of this book. |
wxPython | Yes | Yes | No | wxPython is based on the wxWindows toolkit. wxWindows is a crossplatform wrapper around a native toolkit of each platform: the standard Win32 controls on Windows and GTK on Unix/X11. |
FxPy | Yes | Yes | No | One of the smaller - in terms of user base - toolkits, it is based on the FOX toolkit. FxPy's main feature is execution speed. |
PyGTK (+PyGnome) | Yes (a bit) | Yes | (If you run a separate X Server on OS X) | PyGTK is based on GTK (formerly known as the Gimp Toolkit). Not really intended for cross-platform work, it has recently been ported (more or less) to Windows. |
Pythonwin | Yes | No | No | Pythonwin is the - rather underdocumented - binding to Microsofts MFC library. It's not portable, of course. |
There are many others GUI toolkits available, both dead and alive. For a complete listing, please see Cameron Laird's notes on Python GUI's at: http://starbase.neosoft.com/~claird/comp.lang.python/python_GUI.html. However, the really serious options for someone selecting a toolkit are Tkinter, PyQt and wxPython. I have selected PyQt for my own use, based on criteria of performance, programming model, completeness of the assortment of widgets and ease of installation. Oh, and because it was the most fun to use, of course!
There were other considerations, of course. Tkinter is often very slow - try running the IDLE IDE that comes with Python. In contrast, PyQt is very snappy. The Tcl-tk programming model that Tkinter is based on doesn't translate as well to Python as the modified C++ programming model of PyQt. PyQt has also been very well designed: I just love the signal/slot mechanism of PyQt. There is also just about every type of widget I need, and PyQt is easy to install. WxPython, because it's a library (wxPython) based on a library (wxWindows) based on a library (MFC or GTK) can be really difficult to get up and running. Finally, the GUI designer in BlackAdder (or the free equivalent Qt Designer) is a strong point in favor of Qt, too.
The most important features of PyQt are:
Based on Trolltechs C++ Qt toolkit.
Runs on Windows and Unix/X11 (and soon on Apple's OS X)
Uses the innovative signals/slots paradigm to couple GUI items and actions.
Binds almost the complete Qt library
Allows subclassing of Qt classes in Python
Allows applications to mimic the look and feel of Windows, Motif, CDE, SGI and MacOS 9, or take on a custom look and feel.
Comes with an enormous inventory of advanced GUI controls, such as a canvas, an editable table module and a rich text editor (in version 3.0).