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

Hy Python pythonpython@hotmail.com
Wed, 25 Sep 2002 00:14:52 +0000


Thanks a lot for your great reply, Gregor.

However, I just could not find the method in setdefaultencoding() in when I 
imported the sys module. Do you have to do something special to make 
setdefaultencoding() show up in the sys. namespace?


>>>import sys
>>>dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', 
'__st
din__', '__stdout__', '_getframe', 'argv', 'builtin_module_names', 
'byteorder',
'copyright', 'displayhook', 'dllhandle', 'exc_info', 'exc_type', 
'excepthook', '
exec_prefix', 'executable', 'exit', 'getdefaultencoding', 
'getrecursionlimit', '
getrefcount', 'hexversion', 'last_traceback', 'last_type', 'last_value', 
'maxint
', 'maxunicode', 'modules', 'path', 'platform', 'prefix', 'ps1', 'ps2', 
'setchec
kinterval', 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 
'stdin', 's
tdout', 'version', 'version_info', 'warnoptions', 'winver']
>>>



>From: Gregor Lingl <glingl@aon.at>
>To: Hy Python <pythonpython@hotmail.com>
>CC: tutor@python.org
>Subject: Re: [Tutor] How to display non-ascii charaters on tkinter-made 
>GUIs?
>Date: 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
>>
>>
>
>
>
>
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx