You’re not displaying your stimuli. You will want to create the stimuli outside the loop, and just display them inside the loop via their respective draw()
methods and win.flip()
.
text_2 = visual.TextStim(win=win, name='text_2',
text='You will be presented with words or images to classify into categories using the buttons on the screen. \n \nTry to go as fast as possible while making as few mistakes as possible. \n',
font='Arial',
pos=[0, 0.1], height=0.1, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
polygon = visual.Rect(
win=win, name='polygon',
width=(0.4, 0.4)[0], height=(0.4, 0.4)[1],
ori=0, pos=(0, -.5),
lineWidth=1, lineColor=[1,1,1], lineColorSpace='rgb',
fillColor=[1,1,1], fillColorSpace='rgb',
opacity=1, depth=-1.0, interpolate=True)
text_4_Continue = visual.TextStim(win=win, name='text_4_Continue',
text='Continue',
font='Arial',
pos=(0, -.5), height=0.1, wrapWidth=None, ori=0,
color='black', colorSpace='rgb', opacity=1,
depth=-2.0)
mouse = event.Mouse(win=win)
Pressed = False
while not Pressed:
text_2.draw()
polygon.draw()
text_4.draw()
win.flip()
if mouse.isPressedIn(polygon):
Pressed = True
continueRoutine = False
I also simplified your while
condition and the if
block a bit.
You could even further simplify the while
loop and get rid of the Pressed
variable:
while True: # Forever.
text_2.draw()
polygon.draw()
text_4.draw()
win.flip()
if mouse.isPressedIn(polygon):
continueRoutine = False
break # Exit the while loop.