psychopy.org | Reference | Downloads | Github

Can you use F1, F2 etc as keys? How?

Is it possible to use F1, F2 etc as keys for the keyboard response? How might I do this?

Thanks :slight_smile:

But function keys seem to be a little bit “special”, varying across platform and even from one model of computer or keyboard to another as to whether any particular key generates normal keyboard events or triggers some special function, with or without the “fn” key also being pressed, so your mileage may vary.

1 Like

Great stuff - thank you!

Ok, unless there’s some special trick, it looks like F1 etc aren’t going to be a winner then, according to the demo at least… useful to know about the demo though (I should have thought to look, sorry). Thanks!

(Sorry to revive this - maybe should be a new topic?)

I’m also trying to map the “FN+F4” & “FN+F5” key presses for my current experiment (by default on this Windows 10 machine are volume down and and volume up).

I was hoping to pass these keys to a ratingdial response (to be used as left & right), but when running “what_key.py” and pressing these combinations nothing prints to the console (instead the system volume is adjusted). Is there a way to use these combinations in my PsychoPy experiment?

More context: The reason I’m interested in these combinations in particular is I’m trying to co-opt an external USB dial that by adjusts the system volume.

This seems to work for me on a Windows 10 laptop with a similar key setup. The following will print F1 when pressed in combination with the function key (at least it does in my laptop):

keys = event.getKeys()
if keys:
    print(keys)

Hmm yeah it must be keyboard/computer specific, I get neither the Fn or the F# key to show up when pressing combinations like “Fn+F4” even with getKeys(modifiers=True).

What are the keyboard settings in the Control panel > Keyboard > Fn and Function keys?

Control Panel -> Keyboard just gets me to a Keyboard Properties with tabs of Speed and Hardware (which is just a list of devices, clicking through on one as General, Driver, Details, and Events). I don’t see any options about the Fn and Function keys.

Basically I would avoid using those keys for studies because it varies from machine to machine what will happen with them (e.g. on a laptop you need Fn+F1 whereas on a standard keyboard you don’t)

2 Likes