that example is working for me, but my script still isn’t
I’m using windows 10 and the newest version of PsychoPY.
Here’s a more complete version of the code:
from psychopy import visual, event, core, data, gui
from psychopy.hardware.emulator import ResponseEmulator
info = {}
info ['participant']=''
info ['useMonkey'] = 'n','y'
dlg = gui.DlgFromDict(info)
if dlg.OK == False:
core.quit() # user pressed cancel
win=visual.Window(monitor='testMonitor', fullscr=False, size=(800,800),units='pix', color=[0.506,0.506,0.506])
info['fixTime']=0.68
info['faceTime']=0.907
info['cueTime']=0.507
info['dateStr']=data.getDateStr()
filename="data/"+info['participant']+'_'+info['dateStr']
if str(info['useMonkey'])== 'y':
Monkey=True
else:
Monkey=False
fixation=visual.TextStim(win, color='white', pos=[0,0], height=50, text="+")
target=visual.ImageStim(win, size=80, pos=[300,0],image=None, mask='gauss', color='blue')
imageStat=visual.ImageStim(win, pos=[0,0], size=(250,250), image='sin')
imageCue=visual.ImageStim(win, pos=[0,0], size=(250,250), image='sin')
respClock=core.Clock()
runTrials=True
while runTrials==True:
trials = data.TrialHandler(nReps=1, method='random', originPath=-1, trialList=data.importConditions('main.xlsx')) #change back to practice
for thisTrial in trials:
fixation.draw()
win.flip()
core.wait(info['fixTime'])
imageStat.setImage(thisTrial['fix'])
imageStat.draw()
win.flip()
core.wait(info['faceTime'])
imageCue.setImage(thisTrial['pic'])
imageCue.draw()
win.flip()
core.wait(info['cueTime'])
fixation.draw()
win.flip()
core.wait(thisTrial['SOA'])
target.setPos([thisTrial['pos'],0])
fixation.draw()
target.draw()
win.flip()
respClock.reset()
keys=event.waitKeys(keyList=['left', 'right','escape'])
resp=keys[0]
if Monkey:
simulated_responses=[(0.3,'left')]
responder=ResponseEmulator(simulated_responses)
responder.start()
if resp == 'escape':
core.quit()
and this is the error I’m getting:
RuntimeError: EventLoop.run() must be called from the same thread that imports pyglet.app