The problem of inputting Chinese characters when using textbox

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 22.2.1

I want to use the textbox to input Chinese characters (which are a composition of two or more letters, and every composed string can refer to any of four or more different characters, which people need to disambiguate by choosing which one is the intended one), but the extra layer of inputting Chinese character is not displayed, although I can choose 1 answer. I looked through previous posts and a solution is using dialogue boxes ( Text responses in python: Input() function and dialogue boxes - #3 by miguel_santin ) . But that doesn’t work very well.
So, is there any way I can input Chinese with the extra layer like the figure?


I’m not very familiar with how typing Chinese characters works, is the box in the screenshot a part of the textbox in the software you’re using or is it something put on the screen by a third party typing software?

The screenshot shows the scene of inputting Chinese characters by a third party typing software, and I want to achieve it in the PsychoPy. The textbox now supports Chinese input, but does not show the extra layer of choosing the right characters that you want to use. As shown in the screenshot, I want to input ‘谢谢’, which mean ‘thanks’, so I need to choose the first answer after I inputted ‘xiexie’, which is the pronunciation of '谢谢‘ ( like the relation of ‘/θæŋks/’ and ‘thanks’). The result of lack of the extra layer is that people couldn’t choose what they want to type correctly.

Ah I see, that makes sense as the PsychoPy :textbox: Textbox component isn’t the same as a textbox on a website or software interface - so your software won’t recognise it as a text input.

There’s probably a Python package out there which can handle the conversion from ‘xiexie’ to ‘谢谢’, so it’s plausible that you could use :button: Button components or maybe a :slider: Slider component to simulate this functionality within an experiment… I’ll look for a suitable package and let you know!

It’s also worth checking, it’s entirely possible that a member of the community has already made something like this!

I have something which gets some of the way there; the package dragonmapper allows translation from pinyin to zhuyin, but I’ve not been able to find anything to do pinyin/zhuyin to hanzi. With the help of @suelynnmah I’ve put together a quick demo to show how to implement this within an experiment:

(I made it public so you should be able to find it in the :pavlovia_search: search dialog in Builder and create your own fork, or you can always just click View Code and download the psyexp file)

To run it you need to follow these steps:
to install the dragonmapper package, and if you can find a Python package with a straightforward pinyin → hanzi function then you can install that via the same process and replace the calls to dragonmapper in the example, I just couldn’t find anything with my limited knowledge of how the various Chinese scripts work.

1 Like

Thank you very much for your help. I’ll try it right away.


1 Like

You can use easygui package.

1 Like


do you have a sample script that you can share? I’m struggling with this issue too.

1.visit easygui homepage-download psychopy-path-add easygui
3.befor experiment-import easygui
4.set fullscreen=false
4.befor routine-a=easygui.textbox(‘当前是一个文本输入框,请编辑出您最喜欢的是哪位?’,‘非一般问卷调查’)
5. adddata(a)



Hi Weixing,

I’m struggling with the same issue with Chinese typed response in Psychopy. Can you share the demo with me please? Thank you!


Hi- I met the same problem- Could you please send the demo to my email address (hopefully as soon as you can - thank you):
Thank you.



Hello, it seems that the public code for this Paviovia is invalid. Clicking on it does not include the psyexp file. If it’s convenient for you, could you please upload it again? Thank you。