psychopy.org | Reference | Downloads | Github

Breaking while waiting from event.waitKeys?


#1

Hello,

I am building an experiment, and I use:

math_keys = event.waitKeys(dur_question, keyList=['1','2'], 
            timeStamped=questionClock, clearEvents='TRUE')

I realized that with waitKeys, it halts everything (from the documentation) and waits for the keyList response. So the problem is that even if the particular trial session times out while we are waiting for the key response for dur_question amount of time, the session is not over, and waits for the extra dur_question time until the key press.

Has anyone gone through such problem, and if so is there a way to get around this issue?


#2

Don’t use waitKeys(). You’ll need to shift to continuous checking in a loop using getKeys() so that you can monitor the current time as well as responses.


#3

Hey Michael,

Thanks for the reply. What a simple solution that I couldn’t think of. :slight_smile: