I am recording key presses in fMRI, using a 5-button button-box that sends the letters B,Z,G,R,M over a USB port. I need the pressing of a key to also act as ‘Enter’. My ratingScale component is thus set up with respKeys=[‘b’,‘z’,‘g’,‘r’,‘m’] and acceptKeys=[‘b’,‘z’,‘g’,‘r’,‘m’].
I have noticed, however, that the presentation PC that I use sometimes changes its language settings randomly between English and German. The latter is the default but when the former happens to become the current language, the second button sends a Y instead of a Z, due to the corresponding keyboard layouts for these two languages.
To make my script robust against this random variation, I would like either a Y or a Z input to be recognised as the second key in the list. However, if I just add a ‘y’ to the key list, the complete list of keys gets coded from 1 to 6, whereas I’d like the coding to stay from 1 to 5, with either Z or Y being coded as 2.
Any trick I can try to achieve this? Many thanks in advance!
OS (e.g. Win10): Win 7 PsychoPy version (e.g. 1.84.x): 1.83 Standard Standalone? (y/n) y
You could add a code component to the beginning of the routine to detect the default locale for the system. Hopefully it’s as simple as that. I would first tinker in a python console to see what locales you’re dealing with. Here’s what mine says: