[Pythonmac-SIG] Problem with tkaqua Tkinter and some Kanji unicode values.

Read Roberts rroberts at adobe.com
Wed Nov 17 06:29:12 CET 2004

Has any one else seen the following?

Mac OSX 10.3.6, standard Python from 10.3.4 installation + tkAqua 
Tkinter.tkinter.TK_VERSION is '8.4'

I set a unicode string into a tKinter widget. Some kanji display 
correctly, some do no. The ones that don't show up as a white square 
followed by a black square. Both the Unicode values for the kanji 
that work and the ones that don't are present in the font used by the 
widget. Example:

from Tkinter import *
from tkFont import Font as TKFont
root = Tk()
root.font = TKFont(root, font = 
(u'\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3', 12))
print root.font.actual()
myFrame = Frame(root)
root.resizable(1, 1)
myEntry = Entry(myFrame, borderwidth = 10, font=root.font)
testString = u"\u8146, \u500e, \u440c"
myEntry.insert(0, testString)
print repr(myEntry.get())

The font is used in this example is Hiragino Kaku Gothic-W3. 
FontBook shows that it has glyphs for all three Unicode values in the 
test string.  u8146 shows up correctly, the others do not.  Works 
fine on Windows.

More information about the Pythonmac-SIG mailing list