Time production task that migrates to Pavlovia


I would like to ask participants to produce a 1000ms gap. That is, they press a button, wait 1000ms, then press a button again. I am trying to find a method that translates nicely to Pavlovia.

I tried storing all button presses and using code to end routine on the second press:

if len(keyboard.keys)==2:

which is fine in PP but Pavlovia throws an error because keyboard.keys is not defined until the first keyboard response.

Another option is for the first button press to start the next routine, then I see how long the routine runs for before the participant’s second press, but I’m worried about timing accuracy using that method.

Any ideas?