how to display unicode in a Label in Tkinter

Eric Brunel eric_brunel at
Mon Aug 16 09:54:48 CEST 2004

Ali wrote:
> I was wondering how one would go about displaying unicode in a Label
> object in a Tkinter window. I am trying to display text in another
> language. Please help.

Just put it in a Unicode string or in a raw string encoded in UTF-8 and you 
should be going:

 >>> from Tkinter import *
 >>> root = Tk()
 >>> s = 'àéèù: ça marche!'
 >>> u = unicode(s, 'iso8859-1')
 >>> Label(root, text=u).pack()

(The code above supposes your default encoding is iso8859-1, a.k.a latin-1; 
otherwise, you can do: s = '\xe0\xe9\xe8\xf9: \xe7a marche!')

- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools -

More information about the Python-list mailing list