Hi Jonathan,
Thank you so much for your reply. I have no idea what you mean by TextStim object?
This is my code:
from psychopy import visual, event, core
from psychopy.visual import ShapeStim
win = visual.Window([800,800])
stimBlue = visual.Circle(win,radius=0.2,edges=64, fillColorSpace=‘rgb255’, fillColor=[0,0,255])
stimRed = visual.Circle(win,radius=0.2,edges=64, fillColorSpace=‘rgb255’, fillColor=[255,0,0]) #T1
stimBlue.pos = [-0.6,0]
stimRed.pos = [0.6,0]
feedback = visual.TextStim(win, colorSpace = ‘rgb255’, color=[0,0,0]) # this creates some text
for i in range(1,10): # T3 This command controls the index, this changes by a value of 1 within its range
if i % 2 == 1: # if the trial is an odd number (note - % means “modulus”)
stimOn = 'blue’
stimBlue.draw()
if i % 2 == 0:
stimOn = 'red’
stimRed.draw() #T4
win.flip() # T5 The flip command tells Psychopy we want to present something inside the window we previously set out
key = event.waitKeys(maxWait=5,keyList=['b','r']) # waits for either an r or b key to be pressed. If 5 seconds pass, then it moves on without a response
if key == ['b'] and stimOn == 'blue': # if the key pressed was b and the stimulus presented was blue
feedback.text = "Correct!"
elif key == ['r'] and stimOn == 'red': # if the key pressed was r and the stimulus presented was red
feedback.text = "Correct!"
else: # T6
feedback.text = "Too long!"
if key == ['r'] and stimOn == 'blue':
feedback.text = 'Incorrect!'
elif key == ['b'] and stimOn == 'red':
feedback.text = 'Incorrect!'
feedback.draw()
win.flip()
core.wait(1.5)
win.flip()
core.wait(1)
Many thanks