I’m new to python so I apologize in advance if my question is trivial.
When I present the probe for my task, I want the response to be made with two key presses. I want the two key presses to force the end of the routine, but also if a time limit is reached the routine has to finish.
In other words, I’d want the same as event.waitKeys(), but with two key presses.
I tried using core.wait() like this:
core.wait(5) x=event.getKeys('v, b, n, m') if len(x)>=2: continueRoutine=False elif len(x)<2 continueRoutine=True
But it always waits the 5 seconds, even with two key presses. I guess core.wait() is not “overridden” by the ContinueRoutine=False.
I also tried to use a while loop and a timer:
timer=core.CountdownTimer(5) while timer.getTime()>0: x=event.getKeys('v, b, n, m') if len(x)<2: continueRoutine=True elif len(x)>=2: continueRoutine=False
But it’s not working. I guess it depends on the timing and order in which the operations are carried out, because if I try to print x I get many empty lists.
Any ideas on how to solve this issue?