I am currently working on an experiment for German participants. It is necessary that the German participants are able to type characters such as: ö, ä, ü, ß into a designated input screen. I have successfully build this ability into the experiment on my North American Mac using the German keyboard but I need to know whether it will work on a German computer.
Here’s what my code looks like right now:
if theseKeys[i] == 'return': # pressing RETURN means time to stop continueRoutine = False break elif theseKeys[i] == 'backspace': inputText = inputText[:-1] # lose the final character i = i + 1 elif theseKeys[i] == 'space': inputText += ' ' i = i + 1 elif theseKeys[i] in ['lshift', 'rshift']: shift_flag = True i = i + 1 elif theseKeys[i] == 'minus': inputText += u'ß' i = i + 1 elif theseKeys[i] == 'bracketleft': inputText += u'ü' i = i + 1 elif theseKeys[i] == 'semicolon': inputText += u'ö' i = i + 1 elif theseKeys[i] == 'apostrophe': inputText += u'ä' 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
This set up works well on my laptop, but may not on a native German laptop. What I need to know is whether the name of the key in PsychoPy (ex. “minus”) is based on the physical location of the key on the keyboard or whether the name of the key would change depending on the language that the laptop is built for.
Does anyone know how the keys are identified by PsychoPy?