| Reference | Downloads | Github

event.getKeys with LabJack button-box

Hi all,

I’m working with a button-box connected through LabJack, and trying to find a clean way to collect reaction times. It’s easy to simply poll the state of the button (example at the end of this message). However, it’d be great to have a tool like event.getKeys. This would allow me to run other code while monitoring for responses, only look for presses (not releases), and get time-stamped responses.

Is there a way to use event.getKeys with a LabJack button-box?


# Is there a way to use event.getKeys instead of
# repeatedly polling the state of the button?
from psychopy.hardware.labjacks import U3
d = U3()
d.getDIOState(16) # Gets the current state of the button