Help: Chinese charactor in Tkinter
Zhenlei Jia
zj8k at node14.unix.Virginia.EDU
Sat Sep 30 00:16:53 EDT 2000
I am trying to display Chinese charactor in Tkinter. The following is
the code I've tried, but the texts were displied as "?". Had I missed
somthing, or just I can't do it on my system? I am using MacPython 2.0b1,
Tcl & Tk 8.3.0 on MacOS 8.6, I have installed Chinese Language Kit, and I
can display Chinese char in java, also using unicode.
Thanks in advance!
Zhenlei Jia
##my code
from Tkinter import *
root=Tk()
Label(root, text="abcd").pack()
Label(root, text=u"\u5413abcd", font=("Song", 12))
#\u5413 is a Chinese char, "Song" is a font installed on the mac
Button(root, text=u'\u5413', font=("Beijing", 20)).pack()
#"Beijing" is another font
#'abcd' on two labels looks different from each other, so I know the
#Chinese font did have been used
root.mainloop()
More information about the Python-list
mailing list