Gui Advice Needed: wxPython or PyQT ?

Troy Melhase troy at gci.net
Tue May 6 20:41:28 EDT 2003


Hi Tony,

I recently completed a rewrite of a small-ish app (~5k lines) from wxPython
to PyQt.  My perspective may not be unique or authoritative but it
certainly is current.

Random subjective remarks:

* Using wxPython requires more lines of code than using PyQt for similar
functionality.  An example of this is image handling:  if you forget to
initialize the wx image handlers, you can't display PNG images.  If you
want to display an image with a list item, in wxPython you have to set up
an image list, add images to it, and assign the image list to the control.  
You only have to assign the image object with PyQt.

* I liked wx for it's plentiful examples and documentation.  The number of
widgets also impressed me, as did the flexibility of each.  The wx demo app
is definitive in its breadth. If I had problems using a particular window
class, I could google and find an example easily.  Not so with PyQt -- most
of my google searches come up empty.

* wxPython widget layout is painful.  Very, very painful.  To be fair, it 
really only seems painful because the majority of the toolkit is so
pleasant, but there's a reason it's called "sizer hell."

* I found that when I stopped coding with wx for a while that I would forget
the majority of the method signatures and (more importantly, really), I'd
forget the  idiosyncrasies of each window type.  The docs made up for it,
but I have the short-term memory capacity of a beach ball, and that aspect
of wx programming slowed down my development.

* The PyQt list control is easier to use and more powerful.  For example,
column sorting is provided automatically.

* The PyQt event system is more robust and flexible.  The recent addition of
the eventmgr module in the wxPython library has made them comparable, but
it's still an after-thought.

* PyQt is more forgiving, meaning it segfaults less when you don't use it
correctly.

> Which is faster to learn ?

If you're starting from scratch, I'd bet that you could learn PyQt faster
than wxPython.  All things equal, of course.

> Which GUI is better to use, in the long run ?

That's hard to answer without knowning what you mean by "better" and by
"long run".  I think both frameworks will be around for many years to come,
and both will be available to the Python programmer for just as long.

If you're a wxPython fan, or if you're Robin Dunn, please don't take any of
this as criticism.  To the contrary, I think wxPython is awesome,
particularly for Python programmers on MS platforms.  But I prefer PyQt.

If I haven't answered your questions, please elaborate and I'll try again. 
:)


-troy





More information about the Python-list mailing list