Cameron Laird's personal notes on Python
GUIs
Note: as of 2002, I've largely abandoned maintaining this page, in
the expectation that the main
Python Wiki
would incorporate its content. As of September 2003, that
still hasn't happened, nor have I made the time to move the
material there in a satisfying way. My conclusion: I encourage
readers to use the Wiki, and feel free to ask me specific questions.
There are and, at least for the near future will be, a lot of loose
ends.
Reader Duane Voth rightly points out that one of the important dimensions
for quick assessment of toolkits is their availability and usability
on different platforms. That's the sort of information I'd hope to
keep current on a Wiki ...
Table of Contents
I aim for encyclopaedic comprehensiveness here; that is, I want
pointers to all the questions that arise about Python-bound
GUIs. As a practical matter, though, I recognize Boudewijn
Rempt is right in
writing
I think that there are four
realistic options for Windows development: tkInter,
wxWindows, PyQt and Pythonwin + COM.
The van Rossums used to maintain a
page
of contributed graphical python software, including brief
commentary. While they appeared to have moved on from this
chore, the Vaults of Parnassus has a
streamlined
version.
[Finish adding few
dozen other links.] [especially explain uiToolkit.]
Gerrit Holl once compared different toolkits in a
Web page,
but apparently he's abandoned the effort.
Mikael Lyngvig accurately
summarizes
comp.lang.python discussion of the
technical merits of
Tkinter,
wxPython, and Python-bound
JPI. Malcolm Tredinnick
compares
wxPython and Tkinter astutely.
My thanks to Magnus Lycka for his help correcting the
information in this page.
Someplace I make the case that Pythonians have a better
selection of useful GUI toolkit bindings than even C coders.
Eventually I shall transcribe that argument here. In the meantime,
enjoy the skeleton of pointers which follows:
Andy Bulka has a fascinating
tutorial
in which he demonstrates how fine it is to use
Python
for Delphi components.
"Fltk
("Fast Light Tool Kit") is a fairly new portable GUI toolkit library
for UNIX/X11 and Win32, with OpenGL support, largely compatible
with the XForms library, ..." and distributed under GNU Library GPL.
This is Markus Fleck's
characterization,
in which he adds that, "While written in C++, Fltk does not use macros,
templates, multiple inheritance, or exceptions, and should thus be
quite easily SWIGable." XForms itself apparently
has a non-commercial-use-only license.
Kevin Dalhausen and Bjorn Petterson, among others, are working on
bindings
for Python and Perl. They conduct their work through a
mailing list.
FOX is yet another GUI
that looks to be of interest to Pythonians.
FXPy
is a good Python extension,
with relatively complete documentation.
JPython gives convenient access to AWT and JFC.
JPI
allows Python--CPython, that is--to script Java. It's immature,
as of summer 1999.
[Explain Mark Hammond's expertise.]
Sjoerd Mullender bound
Motif
to Python in a package he calls the
Python
X Extension. As of mid-2000,
"I'm still using it
and occasionally changing it ...", in Sjoerd's words. His
work includes an "application framework" for rapid GUI
development.
www.pygame.org
PyGTK
binds to the
GTK+ toolkit and
GNOME libraries.
While it originally aimed only to be the toolkit for
the GIMP, Gtk is now popular for many, many open-source
projects.
Prominent in the minds of many working with Qt and GTK
are the different licenses under which they operate.
I choose not to describe those controversies; I do
recommend, though, that users study them enough to
understand their consequences. (Is it not thread-safe?)
In mid-1999, Gtk has more widgets than Tk, and generally
feels more responsive. Tk generally remains more succinct.
PyKDE
is now at 2.2. Phil Thompson currently packages it
in two pieces, one for KDE,
and one for Qt. My thanks to Boudewijn Rempt
for updating me on its status, and referring me to the
tutorial
he wrote.
With the official 0.9 release, "[t]here's
also a rather promising visual development environment out,"
as Boudewijn notes,
and the
mailing list
is in good shape.
PyKDE advocates
generally claim it's zippy, easy, and powerful. On the other hand,
pyKDE is (much?) less portable than Qt itself. As Mr. Rempt has
written me, "the problem
is that nobody has ever wanted to spend money on the Qt toolkit
for Windows to try it out!"
The goal of PythonCard
is to duplicate the functionality of HyperCard, MetaCard, ...
In early 2000,
Python
bindings for
Qt
and KDE have become quite capable. PyQt is mature,
a lot of fun, and entirely practical for both Win*
and Unix developers.
Pythonwin is available only for Windows. Its IDE is itself
written in Pythonwin, and is impressive.
Tkinter's
the standard GUI toolkit for Python. Many people protest
that, and in fact have, for years. It remains true.
Among the reasons for Tkinter's longevity:
- It's available for MacOS, Unix, and Windows;
- It's part of the standard Py-distribution;
- John Grayson's
book
covers it intelligently, as do the final eight
chapters of Ivan
van Laningham's
- geometry management is better than anything offered
by, for example, Java
- the Text and Canvas widgets are powerhouses
- it's mature, flexible, and reliable
Tkinter is generally not suited for intensely bit-mapped and/or
three-dimensional applications. There's no drag-and-drop support
standard yet.
Those with an interest in Tkinter will want to read
Fredrik Lundh's notes on Tkinter 3000, accessible through his
Tkinter home page and
Pythonware
product page.
[Explain other aspects of Tkinter, including deployment,
testing, TkGS, uiToolkit, upcoming book, ...]
As David Gobbi explains it in a
posting
Deja no longer exposes,
VTK
is impressive:
Unfortunately,
VTK's python wrappers aren't available under Windows
(or at least, aren't complete yet). Under UNIX,
though, there are tons of impressive VTK examples
that use python. We use VTK under linux, IRIX,
and NT (the last two with hardware OpenGL acceleration).
Since then, as he told me in a private communication,
VTK/python interface was ported to Windows ...
and integrated into the main VTK codebase [early in 1999]. The
most recent VTK release (2.4) for Windows comes with the python
interface pre-built.
I'm working with the
VTK folks to make the
python interface rock-solid for VTK3.0, which should be released
sometime in the fall [of 1999].
This includes Tkinter widgets for 2D and 3D
rendering, plus the ability to pass data (images, vertex arrays, etc)
between VTK and python.
Among VTK's attractions: the Prentice-Hall manual,
and good bindings also for C++, Java, and Tcl/Tk.
wxPython,
based on
wxWindows
2.0, is now sufficiently mature to inspire
wild enthusiasm
in at least some users. Moreover, as Vadim Zeitlin
writes, "unlike probably any other GUI toolkit, wxWindows developers are
interested in making their toolkit useful to the Python community."
The wxWindows development team certainly seems active, with progress
in 1999 on many fronts (including MacOS, multimedia classes, GL, ...).
Still, Robin Dunn's conclusion is that, "I also don't think that
wxPython is ready yet to be included with the Python
distribution."
Several of us have found wxPython to be a bit delicate
in installation.
My thanks to Fredrik Lundh for his help understanding Python's GUIs.
We wrote at more length on related subjects in an
article for
SunWorld Online.
Cameron
Laird's personal notes on Python
GUIs/claird@phaseit.net