Textbox component, the first character entered cannot be displayed

OS : Win11
PsychoPy version : v2022.1.1

  • I want participants to enter a few numbers, so I use the Textbox. When the program runs, but the first digit entered each time cannot be displayed.(just display▯▯▯) However, these ▯▯▯can be removed by “backspace”, then continue typing and the display will be normal. How can I slove it?

Please could you show a screenshot of your textbox component?


Thanks for your reply. The last image is what I typed in “123”, but “1” is ▯▯▯.

  • I think I found the cause of the problem: my psychopy can not dispaly Chinese, when I check the data excl, I found these ▯▯▯ are Chinese characters. In the trail before the routine with textbox(“inputans” in the image), the participents need to press the keyboard three times(f or j), the three letters can become three Chinese characters by Chinese keyboard( Chinese pinyin input method). In other words, whatever the first key typed in textbox routine is, it become the three letters in last trail, and then become Chinese charaters which can not display

    . I don’t know why. Did I set something that I shouldn’t set ?

Ah – that explains it.

You could try textbox.refresh() in Begin Routine to clear the new textbox.

Thanks for your reply! But there was an error when I tried: AttributeError: ‘TextBox2’ object has no attribute ‘refresh’.
In addition, I also asked this question on a forum in my county, I just got a response from a person and he gave me this code:
textbox.setText(textbox.text + " ")
textbox.draw()
So far, it seems to be working. But I don’t understand what these codes mean or if they make sense(because the situation that bothers me sometimes comes up and sometimes doesn’t), So I would like to trouble you to see if this is reasonable. Thanks again! :smiling_face_with_three_hearts:

oh no, the problem comes uo again! It seems that the above code does not solve the problem.