End routine when the correct sentence is typed

Hi! How can I end routing as soon as the sentence is typed in a TextBox? In my experiment, a participant sees a sentence, retypes it, and as as soon this is done, a new sentence is shown.

OS Win11
PsychoPy version 2022.2.4

Hi @Dasha_Mesquita,
if you have a column in your conditions file containing the sentences (sent) and a textbox (box) then you can run this code in “Every frame”

if box.text == sent:
    thisExp.addData("RT", t)
    continueRoutine = False

This saves the time until the completion of the sentence in a variable “RT” and ends the routine.


Thank you!