Dear all
Have an experiment with some allowed keys on the keyboard component working perfectly, but would also need to implement a new feature that will get any keypress except those already allowed for that routine. I was considering including another keyboard component for that, but the only way I visualized doing this is by typing in on “allowed keys $” all my keyboard keys but those already allowed for other functions. I wonder there’s a simpler way of doing this, any suggestion?
Best,
Felipe
OS (e.g. Mac 10.9.5):
PsychoPy version (e.g. 1.85.6):
There can only be one keyboard component operating at a time, or else they conflict with each other. They each check the current event queue for new keypresses, so the one that comes lower down doesn’t receive any of the events either detected or ignored by the one above it.
If you need more flexible handling of keypresses, the best option is usually to drop the keyboard components and handle the keypress detection yourself in code (i.e. insert a code component from the “custom” components pane and put some code on the “each frame” tab that checks the event queues for keypresses on each screen refresh).
Great, thanks!
Through the code component, is there a way of detecting/recording if simultaneous keypress?
Best,
Felipe
Enviado via dispositivo móvel /
Sent from my mobile device
That is actually reasonably tricky, at least un til now. PsychoPy Version 3.1 just released gives access to improved keyboard handling, including the time stamp of when each key was actually pressed, not just when it was checked: https://www.psychopy.org/api/hardware/keyboard.html
That should help. I haven’t used it yet myself though.
I used the solution offered by @dvbridges in this topic and, even though I had to specify all possible combinations I predict (not so many in my case), it’s working perfectly.
Thanks
Felipe