wxPython Or Tkinter Advise PLEASEEEEEEEEE

Russell E. Owen owen at astrono.junkwashington.emu
Mon Aug 13 14:48:00 EDT 2001


They both work, so I think you'll do fine either way.

Here are some considerations. I have used Tk much more than Wx, so have 
much less to say about Wx. Contributions would be most welcome.

Tk:
+ runs on more different platforms (e.g. Mac) than Wx and is more mature
+ has a nice Canvas widget
+ nice file event support for networking applications
  (I don't know about this on Wx)
+ tons of flexibility for button sizes, font sizes, etc.
+ lots of nice layout options
+ lots of books are available on Tk, and at least one on Tkinter
- is fairly slow (you end up running a Tk interpreter as well as the 
Python interpreter)
- has brain-dead support for copy and paste
- has somewhat clumsy mapping from Pyton to Tk. For instance a lot of 
times you end up with a Tk name that you have to then convert to a 
widget before you can do anything with it. I suspect much of this is 
because Tk is not object-oriented.
- bizarre inconsistencies in Tk -- different widgets often have 
different ways of doing the same things
- lack of a nice multi-line text display widget (that the program can 
write to but users cannot alter the text); this is a famouse Tk FAQ, to 
which the answer is to (gag) enable updates (which means the user can 
manipulate the text), write your text, then disable updates again
- some things are broken on the Mac (menus, file events)

Wx:
+ Wx is reported to be much faster than Tk
+ Python is basically an equal partner to the C++ code, and Wx is 
object-oriented, so the mapping appears to be nicer from Python to Wx
- Wx relies on unique ID numbers to describe events (gag)
- no current Mac releases, though if you are willing to check code out 
of CVS you can probably get the Mac stuff running (depending on what day 
you check it out)
o Wx includes a lot of tools that Python already has; I'm not sure how 
this overlap works out

Also, if you care, Wx looks more like Windows, whereas Tk looks more 
like unix X.

The Python 2.1 Bible, by Brueck and Tanner, (a very nice book) has a 
short chapter on WxPython which should get you going. It also has a 
short chapter on Tk, but it sounds as if you may be far enough along to 
not need that.

-- Russell



More information about the Python-list mailing list