GUI Frameworks in Python?

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Apr 6 00:58:25 EDT 2004


Hung Jung Lu wrote:
> Can someone outline some differences/advantages of PyGTK vs. wxPython?

Having had an intensive experience with both recently, I
can give you some of my impressions.

I started a project using wxPython, having heard good things
about it. At first it seemed all right, but as things progressed
I found myself becoming more and more frustrated with it.
Everything seemed to be just a little more complicated than
it needed to be, and I kept on running into bugs, limitations and
strange behaviours that I had to work around.

As an experiment, I tried re-writing it to use PyGtk, to find
out what it would be like. It turned out to be a much more
pleasant experience. The wrapping is very straightforward and
Pythonic, and everything Just Works the way I expect. I've
yet to encounter a single bug or unreasonable limitation.

> A first look at PyGTK shows me a more Unix-like look-and-feel. On the
> other hand, wxPython on Windows does look very much like any other
> Windows applications.

It doesn't look quite the same as native apps on Windows, but
for my purposes it's close enough. If precise Windows authenticity
is important to you, you might have to use wxPython or something else 
that uses native Windows widgets.

> Is the event handling in PyGTK cleaner/better than wxPython?

The basic idea is fairly similar in both, but event handlers
("signal handlers" in Gtk terminology) seem more straightforward
to set up in PyGtk. In wxPython, for example, you have to get the
ID number of the widget and pass that to an event-binding function;
in PyGtk, you just pass the widget itself.

That's just one example of how the PyGtk API is simpler. It might
not sound like much, but lots of little things like that add up
to make me like PyGtk much better.

> Does PyGTK have more widgets?

They seem to be more or less equal in this area, although the
PyGtk text and table/tree widgets may provide more functionality
than their counterparts in wxPython. I'm not sure, since I
haven't had to use much more than the basic functionality of
these widgets. It did seem to be easier to get the PyGtk table
widget to do exactly what I wanted in some cases.

 > Given the lack of comparison, I
> would guess that GTK is unix-friendly, since Unix people usually would
> mention little or nothing about Windows. :)

I would say that PyGtk is more Python-programmer-friendly,
regardless of what platform you're using. The only disadvantage
I can see for Windows is possibly slightly less authentic
appearance.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list