[Tutor] How to display non-ascii charaters on tkinter-made GUIs?

Gregor Lingl glingl@aon.at
Tue, 24 Sep 2002 21:56:56 +0200


Hy Python schrieb:

> Could you please tell me if it's possible to display non-ascii 
> charaters on tkinter-made GUIs?
>
> Can interfaces made with tkinter display non-ascii charaters? 

I have the following code in my sitecustomize.py

import sys,  locale
loc = locale.getdefaultlocale()
if loc[1]:
    encoding = loc[1]
if encoding != "ascii":
    sys.setdefaultencoding(encoding)

And on my machine the following works:

t = "32 " + unichr(0x20ac)
from Tkinter import *
root = Tk()
Label(root, text=t).pack()
mainloop()

Gregor


>
> Can tkinter display the 650,00+ unicode characters?
> Is there a way to set default system encoding to something other than 
> ascii?
> (sys module has a getdefaultencoding() method, but there is no 
> setdefaultdencoding() method.)
>
> Thanks a lot.
>
> Hy
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>