| Reference | Downloads | Github

Breaking while waiting from event.waitKeys?



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?


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.


Hey Michael,

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