| Reference | Downloads | Github

How to display text and symbol input on the screen

Hi everyone,

I have a question regarding text and symbol input from the keyboard. In my experiment, I want everything that a participant types on the keyboard to be displayed on the screen. Therefore, I used the following code:

Begin Routine:
modify = False
text.text = ‘’

Each frame:
keys = event.getKeys()
if len(keys):
if ‘space’ in keys:
text.text = text.text + ’ ’
elif ‘backspace’ in keys:
text.text = text.text[:-1]
elif ‘lshift’ in keys or ‘rshift’ in keys:
modify = True
elif ‘return’ in keys:
continueRoutine = False
if modify:
text.text = text.text + keys[0].upper()
modify = False
text.text = text.text + keys[0]

End Routine:
thisExp.addData(“typedWord”, text.text)

However, when executing the experiment, only letters are displayed and they cannot even write a dot or brackets. How can I modify the code in the way that all letters and also symbols (.,-+@()#") on the keyboard will be displayed?

Thanks in advance for your help!

See Transcription task online