What do I want to do?
I have an experiment where I want to give participants the opportunity to repeat 5 practice trials. To this end, I have two clickable buttons for [continue] or [repeat] in a component I call “ready”. In addition to those buttons, I have some text which should naturally change depending on whether it is the first presentation of “ready”, the second, or the one after clicking [continue].
It should work like this:
1st block: 5 practice trials with their separate conditions file.
2nd block: Either 90 trials of experiment proper with their own conditions file or repetition of 5 practice trials.
3rd block (only, when practice was repeated): experiment proper as described above.
How did I approach this?
Within the “ready” component, I added the following code:
# Before experiment
main_exp = False
# Begin routine
# set text depending on block
if thisBlock == 1:
ready_txt = visual.TextStim(win=win, name='ready_txt',
text='Jetzt beginnen wir mit 5 Übungsdurchgängen.',
font='Open Sans',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0.0,
color='white', colorSpace='rgb', opacity=None,
languageStyle='LTR',
depth=0.0);
elif thisBlock == 2:
ready_txt = visual.TextStim(win=win, name='ready_txt',
text='Wenn du bereit bist, klicke auf [weiter]. Mit [nochmal] kannst du die Übungsdurchgänge wiederholen.',
font='Open Sans',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0.0,
color='white', colorSpace='rgb', opacity=None,
languageStyle='LTR',
depth=0.0);
elif main_exp == True: # This elif is not an else, because I need to check whether the Ifs work at all.
ready_txt = visual.TextStim(win=win, name='ready_txt',
text='Jetzt geht es richtig los!',
font='Open Sans',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0.0,
color='white', colorSpace='rgb', opacity=None,
languageStyle='LTR',
depth=0.0);
# End routine
if mouse.isPressedIn(again_button, buttons=[0]):
num_trials = 5
condfile = 'practice_exp_'+seq+'.xlsx'
elif mouse.isPressedIn(continue_button, buttons=[0]):
num_trials = 90
condfile = 'learn_exp_'+seq+'.xlsx'
main_exp = True
What does my experiment look like?
What is the problem?
Instead of showing the conditional text I set with code in Begin Routine, it shows this:
Please help, I don’t get it. Could it be that I need to redraw the text element or something like that? If so, how? I couldn’t find anything in the internet or used the wrong keywords. Thank you!