tkinter + unicode + bug or feature??

Bob van der Poel bvdpoel at
Fri Jan 24 19:28:19 CET 2003

I've got a tkinter application which (just??) developed a most 
distressing bug. Using tkinter Entry() widgets I gather data. Then I use 
the get() method to grab the data out of the widget and ASSUME that the 
result is a python string.

Well, this worked just fine... but I've just discovered that if any of 
the entered information is outside the ascii range of 0..127 the string 
returned is NOT a python string but a unicode string.

I'm not keen to recode the entire application to use unicode.

But, when the program does any manipulation of the unicode strings, like 
a comparison to a "real" string, the program crashes with a:

      ASCII encoding error, ordinal not in range 128.

So, can I force tkinter to return non-unicode strings? Or can I write a 
function to convert all my Entry widget strings to be non-unicode. And, 
I am dreaming that this is a new problem? I recently upgraded my Linux 
box to mandrade 9.0 and it has installed python 2.2.1.


Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bvdpoel at

More information about the Python-list mailing list