Register special characters (symbols) with shift key


hope all is well.

Is there a way for Psychopy to register special characters (symbols) when being typed during an experiment. When the shift key and a number is pressed, the alternative characters are not presented and registered e.g. ’ ! ’ is not shown when pressing ‘shift’ and ‘1’.

This is the same also for when using the shift key and a special character to register the alternative symbol/character. e.g. ’ : ’ is not shown when pressing shift and ’ ; '.

The responses are programmed to be shown on the screen as they are being typed. I know that everyone’s keyboard symbols will be presented differently as to where the symbols are but this doesn’t matter for the experiment as long as the symbol they opt for o their keyboard is registered and shown.

In the latest release (2020.2.1) we tentatively have a solution! The Textbox component creates a box which participants can type in, which will do special characters like described.

If you don’t want a full textbox then you could also use a Code component each frame to check which keys are pressed and manually code for certain combinations, e.g.

if len(keys) == 1:
    Text.text = key
    if 'SHIFT' in keys and ';' in keys:
        Text.text = ':'
    elif 'SHIFT' in keys and '1' in keys:
        Text.text = '!'


Thank you :slight_smile:

1 Like