If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): macOS Catalina Version 10.15.1
PsychoPy version (e.g. 1.84.x): Psychopy v.3.1.5
Standard Standalone? (y/n) If not then what?: mac
What are you trying to achieve?: exit the loop after clicking on exit button
In my experiment I have two routines in the same loop (you can imagine it as two trials with different levels of difficulty, trial1 and trial2, “trials” is the name of the loop) and after that, I have one ‘Feedback’ routine. In both trials you have an “exit” button on which you can click if you want to stop the trials and go directly to the feedback routine.
What did you try to make it work?: I have the following code for the exit button:
in the tab “Begin routine”:
ExitButton = visual.ButtonStim(win, labelText= “Exit”, pos=(0, -.28))
ExitButton.buttonEnabled = True
in the tab “each frame”
continueRoutine = False
trials.finished = True
What specifically went wrong when you tried that?: This code works in the seconde routine (the one just before the feedback routine) but not in the first one. If I click on the exit button in the first routine I only end the routine and go to the next routine (trial2) but it does not quit the loop and go to the feedback routine.