[Tutor] wxPython, Tkinter (was: program hangs in while loop using wx.yield

Terry Carroll carroll at tjc.com
Tue Nov 16 19:38:19 CET 2010


On Tue, 16 Nov 2010, Patty wrote:

> Hi Terry - I am an alumni of UCSC (University of California, Santa Cruz) 
> and live really close so I can request books throughout the UC system 
> just like you describe and there is no limit - or maybe an extremely 
> high limit - to the number of books I can check out from McHenry 
> Library.  It is so worth paying alumni dues!  There is no way they would 
> transport books to the public library to make it easier for people 
> though - not with the way the city and the university feel about each 
> other :}

You might be surprised.  I would't have expected to get a book from San 
Diego State University sent to the San Jose Public Library, but it did. 
I just entered teh request, and a few hours later, I had anote saying it 
was on the way.  The system finds the copy and obtains it.

It's not on a one-to-one basis, i.e., as if SJPL had an arrangement with 
SDSU; it's more of the libraries deciding to patricipate in the pool.

> If I just can't figure out how to do this with Tkinter and the Python Imaging 
> Library, is 'wxPython' the additional software I would want to install and 
> try with?

wxPython is an alternative to Tkinter.  The advantage of Tkinter is that 
it comes as part of standard Python.  You know that it will be installed 
on any reasonably current Python installation.  If you write a program 
using Tkinter and send it to me, you can be sure that I can run it as long 
as I have Python installed (at least as far as the GUI is concerned; other 
things such as PIL might still be an issue).

wxPython is an API over the cross-platform wxWidgets GUI.  I think it 
provides a cleaner and more native look compared to Tkinter. For what my 
opinion is work (and that's not much -- I'm pretty inexperienced at GUI 
stuff), I find it at least as easy to use as Tkinter, but I recall a 
learning curve when I started.

I don't use Tkinter any more, preferring wxPython, but opinions will vary.

Here's a comparison of the two; it's hosted on a wxPython site, so it's 
undoubtedly slanted toward wxPython:
http://wiki.wxpython.org/Choosing%20wxPython%20over%20Tkinter

Another couple:
http://www.llaisdy.com/static/tech/python/calc.html
http://ojs.pythonpapers.org/index.php/tpp/article/viewArticle/61

However, if you would like an example of using Tkinter with PIL, I would 
be happy to provide you with a very rough program I wrote several years 
ago for my own use (when I still used Tkinter).  It loads an image that 
was taken with a digital camera; reads the date the photo was taken from 
the image's EXIF data; adds a timestamp to the photo, and saves it.

It's very rough; I have the habit of writing something only to the point 
where it's good enough for me, and then stop development on it.  But you 
might find it helpful of a straightforward program that uses both.  It's 
from about 2006 or so, and I am by no means a GUI programming expert and 
was even less so then, so my techniques may be suspect; but I'd be happy 
to send it to you for what it's worth.


More information about the Tutor mailing list