Hi everyone !
I’m new to psychopy, and I’m struggling to break a core.wait() call.
More precisely, I call the function core.wait()
for a bunch of seconds in order to let participant to enter some text. But I would like that, when participant press 'enter'
, the core.wait()
function be deactivated.
Here is an equivalent to what I attempt to do, given what I have understood:
answer_screen.draw()
win.flip(clearBuffer=True)
core.wait(waiting_time)
keys = keyboard.getKeys()
for this_let_key in keys:
if this_let_key.name=='return':
waiting_time=0
break
else:
print(this_let_key.name)
As I understand it, this does not work because I first ask to wait before entering the for
loop. Hence, waiting_time=0
is useless.
However, if I try to put the third line : core.wait(waiting_time)
after the for
loop, keys pressed are not print for some reason that I do not get.
If anyone could help me to get away with this, it would be of great help !