[I18n-sig] Japanese input in Tkinter

Atsuo Ishimoto ishimoto@gembook.org
Wed, 29 May 2002 20:06:59 +0900


On Wed, 29 May 2002 10:43:26 +0200
Fredrik Hugosson <fredrik.hugosson@decuma.se> wrote:

> I set the Windows IME input mode to Japanese, choose hiragana and try to
> write hiragana characters (using romanji input) in the Entry box. All I
> get in the textvariable are questionmarks (?).

Script listed below works fine for me on my environment(w2k Japanese
edition). I think you'll need to update Tcl's system encoding from
Python script, but I don't know how you can do it.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D begin =3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=66rom Tkinter import *

f =3D Frame()
s =3D StringVar()
f.e =3D Entry(f, textvariable=3Ds)
f.e.pack()

def pp():
    print unicode(s.get(), "utf-8").encode("ms932")

f.b =3D Button(f, text=3D"prt", command=3Dpp)
f.b.pack()

f.pack()
f.mainloop()

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D end =3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


--------------------------
Atsuo Ishimoto
ishimoto@gembook.org
Homepage:http://www.gembook.jp