for trial in Trials:
stim.setColor(trial[‘color’])
stim.setPos([trial[‘position’],0])
#fixation
selfx.draw()
win.flip()
core.wait(inf_time[‘cueTime’])
#stimulation
stim.draw()
win.flip()
respClock.reset()
core.wait(inf_time[‘stimTime’])
#clear screen
win.flip()
#wait for responses
keys = event.waitKeys(keyList = [‘left’,‘right’])
resp = keys[0]
rt=respClock.getTime()
if resp=='left’and trial[‘color’]==‘red’:
correct=1
elif resp=='right’and trial[‘color’]==‘green’:
correct=1
else: correct=0
win.flip()
Please follow this guideline:
When you include python code on this forum please put triple “backticks” like this ``` on the line before and the line after your code.
If you’ve done it correctly then your code will appear in a grey box with correct indentation like this (check the preview of your post on the right hand side before posting it) and other people will be better able to work out what might be right/wrong with your code.
if myVal==True:
break
If you’ve already posted something that didn’t follow this rule th…
Also please try to write a full question rather than just paste in a section of code. Don’t assume that what you can squeeze in the title of your post will be enough to tell people the relevant context and issue. Help us to help you.