Help: Chinese charactor in Tkinter

Zhenlei Jia zj8k at node13.unix.Virginia.EDU
Mon Oct 2 10:46:07 EDT 2000


On Sat, 30 Sep 2000, jepler epler wrote:

> On Sat, 30 Sep 2000 00:16:53 -0400, Zhenlei Jia
>  <zj8k at node14.unix.Virginia.EDU> wrote:
> >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.
> 
> In tcl, strings are converted from various character sets to the
> "system encoding" by way of the command "encoding convertfrom".
> 
> This appears to be supported internally by Python in Modules/_tkinter.c:
> AsObj() (the block if (PyUnicode_Check(value)) ...), so I'm not sure
> why this doesn't work.  I would test this out myself, but the version
> of tk I have installed here (8.0) is too old to support unicode.
> 
> If you can execute tk's "wish" program directly, try running the following
> code:
> 	button .b -text \u5413abcd -font {Song -12}
> if you can see the chinese character now, the fault lies somewhere
> within Python; if not, the fault lies somewhere within tk.
I have tried it, no lucky. But I can get the right result on a Win
System(don't know the version of Tcl/Tk, but they came with python1.6b1) 
. Maybe there is somthing wrong with the installation of Chinese
Language Kit of the Mac(although other App. can work well).

Thanks for your advise!

Regards, 

Zhenlei Jia 




More information about the Python-list mailing list