Caps lock key button

Does anybody know the key string for caps lock? I have tried ‘capslock’, ‘caps_lock’, ‘Caps Lock’ ‘CAPSLOCK’, ‘caps lock’ etc. and none are working. I simply want to display a stim if the caps lock button is pressed. My code is working with any other button, but the caps lock is not working. Thanks!

Hi there,

This should be ‘capslock’ but if you need to check/test this out in future go to coder view> demos >input> what key and this will print out the key labels for the buttons you press :slight_smile:

Becca

Thank you. I am using kb.getKeys(). Perhaps it’s different for this?

Hi There,

OK for the keyboard class, if you use the coder>demos>keyboardNEW.py and press the caps lock does this read the capslock label?

That should hopefully give you the label you want for that method.
Becca

Thanks for your help!

Is there a way to see what the caps version is for keys. Like ‘F’ for ‘f’. I cannot seem to make it case sensitive

Hi there,
Get keys is not case sensitive. Are you trying to get typed responses?

I am trying to get a response from either the caps button or return button. For some reason, the caps button is not working. only the return. Any help would be amazing as i am very stuck.

    while timer.getTime() < 1.5: 
    
        current_time = timer.getTime()
        key = kb.getKeys()
         
        if 'capslock' in key:
            draw_yes_screen = True
            draw_no_screen = False
            allow_work = True
            break

        elif 'return' in key:
            draw_no_screen = True
            draw_yes_screen = False
            allow_work = False
            break