DirectEntry does not work with Chinese IME

Hello,I’m using DirectEntry in my code,but it does not work when input Chinese characters.
I need some help to fixed this.

Already set “text-use-harfbuzz true” in the Config.prc file which in the setup folder/ect.

Here is my code below.
import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectGui import *
from panda3d.core import *

#add some text,want to display some Hanzi content
bk_text = “这是我的Demo” #displaying Hanzi, works
font = loader.loadFont(“zkwy.ttf”)#load target Hanzi font

textObject = OnscreenText(text=bk_text, pos=(0.95, -0.95), scale=0.07,
fg=(1, 0.5, 0.5, 1), align=TextNode.ACenter,
mayChange=1)
textObject.setFont(font)#set target Hanzi font

#callback function to set text
def setText(textEntered):
print(“text entered”)
textObject.setText(textEntered)

#add text entry
entry = DirectEntry(text = “”, scale=.05, command=setText,
initialText=“输入Something”, numLines = 2, focus=1,
entryFont=font)#set entryFont to enable display Chinese Hanzi

#run the tutorial
base.run()

When runs the code, it can display the Chinese Character Hanzi content in both OnscreenText and DirectEntry, But just can’t input Chinese Hanzi content.

Here is the detailed program behavior when trying to input Hanzi.
The IME works when try to input Hanzi. After finish Hanzi content input, there appears a widget with a green arrow on it. It maybe some widget works together with IME, But the Chinese characters can’t put into the entry.

It seems that, the Panda3d widget can’t get content from IME, or can’t update its appearance after got Hanzi content.

The following is the developing environment Information.
Windows 11
Python 3.12.2
Panda3D-SDK-1.10.15-x64
IME Sogou, download link, https://shurufa.sogou.com/

Please help,thanks a lot. :smiley:

Hi,rdb, please take a look at my problem, thanks. :smiley:

Hi! Sorry for the late reply. You can tag me directly with @rdb, for future reference, so that I get a notified.

This seems like it may be a bug with this specific IME. I’m happy to look into this the next time I’m at a Windows computer, are you able to report a bug on GitHub so I won’t forget it, with instructions for how I can replicate this?

Hi, rdb,

I am very glad to see your reply. I cannot submit bug on GitHub. The IME mentioned above is commonly used by everyone in China. I want to upload a instructions video zip attachment in this post, but the site prompts me that new user cannot submit attachments. :face_with_raised_eyebrow:

I think i can upload attachment after i am not a new user.

Here is the text instructions below.

step 1, install the IME in your windows pc.

step 2, run the code of the previous post.

step 3, press ctrl+space to switch to Chinese input mode and enter the following characters: ninhao, Then the first option in the IME candidate area should be “您好”, meaning hello. At this point, if the mouse clicks on the“您好” option, it means that the IME has selected target Chinese characters and the target characters should appear in the DirectEntry. But the fact, The target Chinese characters neither appear in the widget with a green arrow nor in the DirectEntry. There seem to be two possible reasons: First,The widget with a green arrow did not receive the characters. Second, The widget did not pass the characters to the DirectEntry, I think the first is more likely.

Hope these contents can help solve the problem :smiley:

Thanks.