Still on python GUI toolkit

Luca Fini lfini at arcetri.astro.it
Fri Nov 23 08:01:53 EST 2001


Dear friends,

I started a discussion (yet another ...) on the right GUI development 
toolkit for an application few days ago. I received many useful replies 
and I'd like to say thank you to everybody and add a resume of the 
discussion which may be useful for other too.

Problem: I've got to choose a GUI development toolkit for a software
project (the software interface to control a pretty complex scientific
instrument which is a component of a big telescope).

We want to use Python as scriptimng language and the lower level stuff 
will be written in C. I'd like to have a GUI develpment tool which can be 
used in Python but also allows to code critical parts in C.

The environment both for development and for the target system is Linux, 
but an MS Window compatible GUI could be useful.

After some searching I got to four possible solutions: pygtk, PyQt, 
Tkinter, wxWindows. I also did some tests to verify the speed of the same 
program with the different implementation.

The test is as follows: repeatedly painting a square area with small 
rectangles, all black and all white alternately: this emulates the real 
situation where you must display a graytone image by drawing each 
pixel as a small square. The implementation for PyQt, pygtk and wxWindows 
are very similar: I use the respective DrawRectangle function. I do not 
try to manage redrawing when the window comes in the foregraund and things 
like this. So I think the comparison is pretty fair. Tkinter has not (to 
my knowledge) a similar function, I define an array of Rectangles and I 
paint the big square by changing the color property to all the small 
Rectangles. Tkinter manages by default the repainting of the window when 
is comes to the foreground, I didn't find a way to avoiid this, so I 
believe it has to do more work to paint and for this reason the test is 
not fair with Tkinter. 

I didn't do very precise measurements because I only need a gross 
evaluation: speed is not the only important aspect.

Here follows a resume of my findings (it includes pygtk together with what
I've already posted):

If I put Tkinter to 1, I get the following relative speed:

Tkinter    1
PyQt       4
wxWindows  4
pygtk     15


Here follows a brief resume of the answers I've got (I've included only 
the ones on the topic and not a few branches regarding Java and CORBA)

Boudewijn Rempt gave me many hints on how to get PyQt working. Then I
discovered that my RedHat 7.2 system had it included (albeith not the very
last release)

Eddie Corns gave an overview of his experience and pointed me to a
comprehensive analisys of GUI toolkits: http://www.atai.org/guitool (very
valuable)

François Pina pointed me to gtk (which I didn't consider at the
beginning), after his advice I repeated my tests with gtk, too. He also
offered advice and more (even pieces of code: thanks again) on one weak
point of pygtk: documentation.

Laurent Pointal pointed me to a recent workshop on experiment control in
the high energy physics field: http://www.esrf.fr/taco/workshop/
Very Interesting, I'll try hard to find the full text of papers from
that. He also commnets on the fact that there is not yet a clear winner
in the GUI toolkit war.

Kevin Altis spent a word about PythonCard which is (if I understand it
all) something like an implementation of Apple's HyperCrd for Python (see:
http://pythoncard.sourceforge.net/) It looks interesting but I think it's
outside the scope of my application. He also commentd on the use of
Tkinter canvas for million points plots.

Fredrik Lundh and Tyler Eaves commented on the right way to do tests and
pointed to some interesting developments of Tkinter: Tkinter 3000
http://www.pythonware.com/products/tkinter/tkinter3000.htm

Many thanks to everybody.

						l.f.

-- 
--------------------------------------------------------------------------
       -- )     Luca Fini                            Tel: +39 055 2752 307
 ___    |\      Osservatorio Astrofisico di Arcetri  Fax: +39 055 2752 292
/   |   | |-_   L.go E.Fermi, 5 +-----------------------------------------
(___|___//___)  50125 Firenze  /   WWW: http://www.arcetri.astro.it/~lfini
 (_)      (_)   Italia        / e-mail: lfini at arcetri.astro.it
-----------------------------+--------------------------------------------





More information about the Python-list mailing list