OS : Windows 10
PsychoPy version : 1.90.1
What are you trying to achieve?: I have added a code component to my experiment, where participants can type the answer at the same time it is displayed. This works perfectly, however, it does not support keys with accents (á, é, í, ó, ú). My experiment is in Spanish, so I need to fix this.
I really have no idea how to do this, so any help is welcomed.
My code component looks like this:
inputText = " "
shift_flag = False
i = 0
while i < n:
if theseKeys[i] == 'space': # pressing SPACE means time to stop continueRoutine = False break elif theseKeys[i] == 'backspace': inputText = inputText[:-1] # lose the final character i = i + 1 elif theseKeys[i] in ['lshift', 'rshift']: shift_flag = True i = i + 1 else: if len(theseKeys[i]) == 1: # we only have 1 char so should be a normal key, # otherwise it might be 'ctrl' or similar so ignore it if shift_flag: inputText += chr( ord(theseKeys[i]) - ord(' ')) shift_flag = False else: inputText += theseKeys[i] i = i + 1
Thanks in advance!
I hope you have a very good weekend!