[Tkinter-discuss] tk 8.3 and unicode

Jeff Epler jepler at unpythonic.net
Fri May 27 16:06:20 CEST 2005

This bug must have been fixed between Python 2.2 + Tk 8.3 and Python 2.3
+ Tk 8.4.

Running a slightly different test program, I get this output on Fedora
Core 1 (Python 2.2 + Tk 8.3):
and this output on Fedora Core 2 (Python 2.3 + Tk 8.4):

You could try defining a
    class UStringVar(Tkinter.StringVar):
        def get(self):
            return Tkinter.StringVar.get(self).decode("utf-8")
and using that instead.  This seemed to work on the FC1 system, at least
when LANG=en_US.UTF-8 -- this might depend on tcl's idea of the sytem
encoding, though.


Test program:

from Tkinter import *
t = Tk(); t.withdraw()
s = StringVar(t)
print repr(s.get())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20050527/0c2b5c9b/attachment.pgp

More information about the Tkinter-discuss mailing list