Tkinter vs wxPython: your opinions?

Greg Landrum glandrum at my-deja.com
Thu Jan 25 19:00:18 EST 2001


There's already been a lot of good stuff posted in this thread, but
I'll go ahead and toss in my several cents.

I've used both toolkits a reasonable amount, but I switched to wxPython
exclusively about a year ago.  I'll try and explain why below, maybe
I'll even succeed in doing so comprehensibly.

Overview:
Tkinter feels easier.  It's simple to open a window, put stuff in it,
and end up with something useable.

wxPython is more complicated, you have to do more stuff to get an
application started.  This can be a barrier to entry.  I like to have
stuff up and running RIGHT NOW and that was harder to make happen in
wxPython.  Of course, it's just like doing X programming: you write the
startup code once (or borrow it from someone else) and then never worry
about it again.

Documentation:
The documentation for Tkinter used to be a problem, but it has
improved a lot over the past couple of years.  John Grayson's book
helps a lot, as does the expansion of Fredrik Lundh's online docs.

When I first started using wxPython, I was really impressed with the
quantity of documentation distributed with it.  Most every class is
well documented and there are a number of overviews as well.  The
downside is that the sheer volume of documentation is intimidating...
there's a lot to read and finding what you want isn't always trivial.
Luckily, Robin includes a great demo with the package which includes
sample code for all the widgets.  This is enough to get you started with
a widget, the rest of the stuff can be found in the docs.

One very important thing to remember is that wxwindows is MUCH more
than a GUI toolkit.  There is all kinds of cross-platform functionality
in there that (I think) isn't even exposed in wxPython.  This makes
the docs look bigger and scarier than they actually are.

The wxPython mailing list is also a good source of information and help.

Speed:
This is much harder to evaluate.  I found that stuff I wrote in Tkinter
almost always felt slow.  I could generally improve this by profiling,
reading the Tkinter source, and optimizing my code.  For many operations
on the canvas, it's pretty easy to get factors of 5-10 in speed
improvement if you can make assumptions about what you are doing.  This
isn't always pleasant to do, but it works.  I'm guessing that Fredrik's
new Tkinter stuff is going to help out a lot on this front... at least
that's how he advertises it and I believe him.

My wxPython apps normally feel pretty fast, so I don't find myself
needing to spend time trying to optimize them.

Widget sets:
Both toolkits have a good set of widgets available (as long as you
use PMW with Tkinter).  Each has, however, one really cool thing
that the other doesn't.

Tkinter has the canvas.  If you are doing graphics, the canvas is just
amazingly cool.  It is very very flexible and easy to use.  wxPython
does not have anything which is even close.  Of course, last I used
it Tcl/Tk was still incapable of drawing dashed lines unless you applied
a patch.  So no dashed lines on your canvas.  I don't understand this
omission from Tcl/Tk, but I learned to live with it.

wxPython has wxGrid, a very powerful spreadsheet-type widget.  The grid
is the primary reason I switched to using wxPython.  I needed that
functionality and writing it yourself is just nightmare.

Appearance:
This is, of course, purely subjective.  I don't like the way Tcl/Tk
applications look.  I can't really put my finger on one thing in
particular, but they just don't strike me as being right.

wxPython uses native widgets, so it looks just great on my Windows box.
When I run it under Linux, it looks just as mediocre as the other apps
written using GTK.

Portability:
My Tkinter apps worked just great on every OS I tried.
The wxwindows docs let you know when you are going to get into trouble,
so it's fairly easy to avoid problems.  That said, to the best of my
knowledge, there is still no Mac version of the more recent versions
of wxwindows.

Stability:
Tkinter wins here in a big way.  Tcl/Tk (and Tkinter) strike me as
being stable and mature.  wxwindows is still under active development.
This can easily rear up and bite you on the ass.  There have been
instances where APIs change between releases (one, in particular,
involving wxGrid caused me to have to go back and fix a bunch of code).
The docs also sometimes lag a bit (wxGrid, my favorite widget, *still*
doesn't have current docs even though the new Grid has been around for
more than 6 months).


Misc:
Both toolkits have really good spiritual leaders.  Both Robin and
Fredrik are active in the newsgroups and are very helpful.

The original poster mentioned xmlrpc.  I assume that this works with
Tkinter, I know that it is just fine with wxPython.


Hmm... I've reached the end of my brain dump and I realize that I didn't
really explain why I'm still using wxPython.  Oh well... it must be
that damn wxGrid.  ;-)

I hope this helps in some way,
-greg




Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list