I need some help to “pause” and “resume” a trial at any time?
In my experiment, each trial consists of a sequence of 30 images, each of the images being presented for 500 ms. I would like the participants to be able to pause at any time (to give an oral answer), and then to resume the sequence, starting again at the next image. Each sequence of 30 images must go on till the end of the trial, and the participants must be able to pause and resume at any time of the sequence. I just need to identify on which images participants pressed the pause key, that’s why I created a keyboard component for each image, to identify when key was pressed.
I don’t know much about coding, and I don’t need to use it very often, so I found a code to pause and resume:
pauseKey = event.getKeys() txt = visual.TextStim(win,text='paused, press space to resume') if 'space' in pauseKey: td = win._toDraw win._toDraw =  # hides whatever was being auto-drawn while not event.getKeys(keyList=['space']): txt.draw() win.flip() win._toDraw = td # restore auto-draw pauseKey = NOT_STARTED pauseKey = 
It enables to pause and resume, but the problem is that during the pause, the sequence keeps going on (invisibly of course) and as a consequence, when I press “resume”, it starts again several images later (according to the duration of the pause). Yet I need it to start again on the next image of the sequence.
Thank you very much for your help!