Update for anyone who stumbles upon this thread in the future:
So after looking around more I found this previous thread on a similar subject. There, Michael linked to a closed issue on PsychoPy’s github project. As far as I understand, the method I described above is actually recommended (though it seemed like a hack to me). One has to make sure to have one of the most recent versions of PsychoPy though, because of differences in previous versions regarding at what point the default continueRoutine
value is set.
What I ended up doing was:
### 'Begin Experiment'
# import function for randomly determining when to pose post-trial
# question
from random import shuffle
# generate list of boolean values which specify if a post-trial
# question should be posed ("Was there an animal in the picture?")
post_trial_bools = [False] * 40 + [True] * 40
shuffle(post_trial_bools)
# initialize counter for going through post_trial_bools values
post_trial_counter = 0
### Begin Routine
# check if post-trial question should be posed, and otherwise
# skip it
post_trial_bool = post_trial_bools[post_trial_counter]
if not post_trial_bool:
continueRoutine = False
### End Routine
post_trial_counter += 1