Hi everyone. I am pretty new in coding, and trying to build an experiment by using the builder.
I am trying to build a routine in which participants will watch lines on the screen and hear sound stimuli. While doing so, I want them to stop the routine if they remember something (this is an involuntary memory task) by pressing a key, and then continue without messing up with the timing and the rest of the stimuli.
I have used this code:
pauseKey = event.getKeys() txt = visual.TextStim(win,text='paused, press R to resume') txt2 = visual.TextStim(win,text='press P to pause') txt2.draw() if 'p' in pauseKey: td = win._toDraw win._toDraw =  # hides whatever was being auto-drawn while not event.getKeys(keyList=['r']): txt.draw() win.flip() win._toDraw = td # restore auto-draw pauseKey = NOT_STARTED pauseKey =  if 'escape' in pauseKey: core.quit()
It works in terms of pausing, but it actually continues to run at the background (without showing me of course). How can I achieve pausing without the code running at the background?
(Sorry if I’m messing up with the terms here…