[I18n-sig] Japanese input in Tkinter

Fredrik Hugosson fredrik.hugosson@decuma.se
Mon, 24 Jun 2002 16:09:09 +0200


Hi all!

On the problem of getting IME input into a Python StringVar coupled to
an Entry field.

I called tk from python with the following:

f = Frame()
print f.tk.call('encoding', names')

and a whole bunch of encodings were printed, so they are there.

>From what I can understand, Tcl/Tk or _tkinter garbles the string data
when getting it from the OS, before setting the variable value. If I set
the value from my program, everything works as expected.

When running from python Tcl/Tk 8.3 is used.

I then tried running some Tcl demos that came with the 8.4 installation
for windows. And there I get the IME input to work fine, and the
japanese characters are correctly displayed in the Entry field after
sending them from IME. So 8.4 seems to work fine.

So now i wonder... I have tried to get the python installation to run
the 8.4 dlls but it won't use them, FixTk finds them but when printing
the version at the start o tkinter.py I see that 8.3 is used. I guess I
need a new _tkinter too. Anyone know how to do this?

/Fredrik.


"Martin v. Loewis" wrote:
> 
> Fredrik Hugosson <fredrik.hugosson@decuma.se> writes:
> 
> > Does anyone have a solution or similar experiences?
> 
> You should indeed make sure that Tcl finds its encoding files. Try
> executing "encoding names" for a tkapp object, to verify you get a
> long list of encodings. If you only get the system encoding and UTF-8,
> it didn't work - try the FixTk.py script from the Python CVS in this
> case.
> 
> I'm also surprised that Tk supposedly works with MS IME; I know for
> fact that it doesn't work with XIM (on X11). You may want to verify
> that Tk really supports MS IME on your system, by installing a plain
> Tk 8.3 on your system.
> 
> HTH,
> Martin