solved:problem in DirectEntry support Asian languages ?

hi! Everybody,
I am a beginner in panda3d. I got some problem in DirectEntry supporting Asian languages.
I am using Windows 7 Professional version and Panda3d 1.7.2.
Can anybody help me.

My case:
I can’t use DirectEntry to get the input of Asian Language, event I can display initialText correctly.
I check the DirectEntry.py, and I found that.
The self.guiItem.getTypeEvent() can be trigged, if English or Number has been inputed. But not for Asian language.

Then I tried Tkinter.Entry() to get the input of Asian language. It can be got and displayed correctly for Traditional Chinese, Simplified Chinese and Japanese.

And I found the strange phenomenon,if I toggled between Tkinter.Entry() and DirectEntry():
The self.guiItem.getTypeEvent() can be trigged sometimes, if Chinese has been inputed.
And I can get big5 code for Traditional Chinese Input, GB code for Simplified Chinese input, ? for unicode input. Surely wrong display.

I got 2 question:

  1. How to trig self.guiItem.getTypeEvent(), if Chinese has been input?

  2. How can I get the current code page information from IME of windows

Sorry for my poor English.
Can anyone tell me, if you know the problem or answer?

Thanks

It’s a shot in the dark, but if there are ? for unicode maybe the font you use has no asian letters?

I’m sorry that I don’t understand very clearly what you are asking.

  1. getTypeEvent() is supposed to be triggered when typing Chinese text via the IME. In general, it will trigger an event each time the candidate text is accepted and added to the string.

  2. The result is always returned in Unicode, or whatever encoding you have configured Panda to use (which may be utf-8 by default).

As wezu points out, it is important to ensure that your font has the correct definitions for all of the characters you will be typing.

David

At the begginning, getTypeEvent() can’t be trigged, if Chinese txt has been input.

The IME will create a window for editing. The window will disappear and getTypeEvent() can’t be trigged, if enter has been pressed. And no display in DirectEntry()

The I add the Tkinter.Entry() and set focus on it.
Change the IME into Chinese
Close/Minimise the TK window. Focus on DirectEntry()

IME still will create a window. But the getTypeEvent() can be trigged, if enter has been pressed.
Then I got key codes of D8 & 76
getText() result is C2 D8 C2 76
getWtext() result is cp950 codec can’t encode u’\76D8’

I got 2 question:

  1. How to trig self.guiItem.getTypeEvent(), if Chinese has been input?

  2. How can I get the current code page information of windows

Thanks

Was the character you typed ‘盘’? This is Unicode character 76D8. This is what is being returned by both getText() and getWtext().

I think the error message “cp950 codec can’t encode u’\76D8’” is coming from your output module, when you attempt to print the result of getWtext(), but it isn’t coming from getWtext() itself. Your default Python codec must by cp950, but this has nothing to do with Panda or getWtext(). Try instead:

print repr(myEntry.guiItem.getWtext())

Use repr() to avoid problems with your output module.

As to the focus issue with the IME, that does sound like a nasty problem. I haven’t encountered that problem before.

David

I test it again,
I can’t input English in TK window event the IME is English

So It seems like TK window response for trig IME Chinese.
I must focus on TK window, if change to IME Chinese
from IME English.

So, How can I know the setting different between IME Chinese and IME English in panda3d?

Nice surprise about this shorter form. Can you tell us what it is you are talking/writing about?
Has any info. about this shorter form been posted before (and i just missed it)?

Perhaps the IME focus is confused by Tk. Does it work as expected if you do not create a Tk window, and instead use Panda only?

David

Set ime-aware to True solve the problem

ConfigVariableBool("ime-aware").setValue(True)

shlee,

Thank you. It is work