[Tkinter-discuss] Unicode in Tkinter in MacOS
Mike Gasser
mikegasser at sbcglobal.net
Wed Oct 4 03:27:46 CEST 2006
This may be just a Mac problem, but I find that in MacOS (10.4) I can
only get Tkinter to display the characters in the Latin-1 set and
Japanese. Possibly others, I don't know, but many Unicode characters
display as garbage characters. The simplest way to illustrate this
is with the little Romanian "hello world" program that Jason
Orendorff uses to illustrate Unicode display in Tkinter on his oft-
cited "Unicode for Programmers" site: http://www.jorendorff.com/
articles/unicode/python.html
###############################################
# hello-romanian.py - Demonstrates Tkinter's Unicode support
#
# This sample code accompanies the article "Unicode for Programmers"
# at http://www.jorendorff.com/articles/unicode .
from Tkinter import *
import tkFont
root = Tk()
myFont = tkFont.Font(size=18)
w = Label(root, text=u'Bun\u0103-diminea\u021ba, lume', font=myFont)
w.pack()
root.mainloop()
####################################################
The two non-Latin-1 characters in the Romanian string appear as
squares. This also happens when I explicitly set the
font family to a Unicode font like 'Arial Unicode' or 'Lucida
Grande'. Of course it's not just Romanian. I need Ethiopic
in particular, and will need other character sets later on, and I
can't get it to work.
Am I missing something? Or is this a limitation of Tkinter in MacOS
(in which case it's not going to be very useful for me)?
(I'm running Python 2.5, but this happened in 2.4 too.)
Mike Gasser
Indiana University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20061003/b5b73885/attachment.html
More information about the Tkinter-discuss
mailing list