| Reference | Downloads | Github

Start a routine with a keypress

OS Win10:
PsychoPy version 1.84.2:
**Standard Standalone? y

Hi all,
I’m guessing that what I’m trying to do is fairly straightforward. I created an antisaccade routine in Builder that runs in a loop in which the user has to look to a certain location and then press a button on the keyboard based on what appears at that location. At present, as soon as the keyboard response is made, the next iteration in the loop (i.e., trial) runs automatically. I would like the user to be able to start the next trial with another key press. I’m familiar with programming in C and C++ but am new to Python and Psychopy, so I’m not certain how to proceed. I apologize for being vague here - any suggestions would be appreciated - thank you in advance.


Hi Chris,

The most “Builder” approach to this is just to insert another routine after your current routine, with its own keyboard component. i.e. the first keyboard response ends the main trial routine. The second keyboard component ends the second routine, allowing the next iteration to run. The keyboard component is set to have an indefinite duration. You can copy the final stimuli across from the first routine if necessary so that the subject won’t necessarily see any visual disruption. Alternatively, you can clear the stimuli and put up a “Push any key to continue” prompt.

Thank you - that took care of it. I think I have to get used to thinking in terms of how the builder works.