screen = Screen() blankscreen = Screen() hitscreen = Screen() hitscreen.clear(colour=(0,255,0)) misscreen = Screen() misscreen.clear(colour=(255,0,0)) # create eyelink objecy eyetracker = EyeTracker(disp) # eyelink calibration eyetracker.calibrate() # display surface disp.fill(screen=blankscreen) disp.show() # # # # # # game # run several rounds for trialnr in range(0,TRIALS): # start eye tracking eyetracker.start_recording() eyetracker.log("start_trial %d" % trialnr) trialstart = libtime.get_time() # run game points = 0 stimpos = STIMPOS
instfile = open(INSTFILE) instructions = instfile.read() instfile.close() instfile = open(INSTFILE_DC) instruction_dc = instfile.read() instfile.close() # read all image names images = os.listdir(IMGDIR) image_size = (555, 987) # display instructions scr.draw_text(text="Press any key to start the calibration.", fontsize=TEXTSIZE_L) disp.fill(scr) disp.show() # wait for a keypress kb.get_key(keylist=None, timeout=None, flush=True) # calibrate the eye tracker tracker.calibrate() # # # # # # RUN # display task instructions scr.clear() scr.draw_text(text=instructions, fontsize=TEXTSIZE_M) disp.fill(scr)
# eye tracking tracker = EyeTracker(disp, trackertype='dummy') frl = FRL(pos='center', dist=125, size=200) # input collection and storage kb = Keyboard(keylist=['escape', 'space'], timeout=None) log = Logfile() log.write(["trialnr", "trialstart", "trialend", "duration", "image"]) # run trials tracker.calibrate() for trialnr in range(0, len(IMAGES)): # blank display disp.fill() disp.show() libtime.pause(1000) # prepare stimulus scr.clear() scr.draw_image(IMAGES[trialnr]) # start recording eye movements tracker.drift_correction() tracker.start_recording() tracker.status_msg("trial %d" % trialnr) tracker.log("start trial %d" % trialnr) # present stimulus response = None trialstart = libtime.get_time() while not response: gazepos = tracker.sample() frl.update(disp, scr, gazepos)
# # # # # # PREPARE # load instructions from file instfile = open(INSTFILE) instructions = instfile.read() instfile.close() # read all image names images = os.listdir(IMGDIR) # display instructions scr.draw_text(text="Press any key to start the calibration.", fontsize=TEXTSIZE) disp.fill(scr) disp.show() # wait for a keypress kb.get_key(keylist=None, timeout=None, flush=True) # calibrate the eye tracker tracker.calibrate() # # # # # # RUN # display task instructions scr.clear() scr.draw_text(text=instructions, fontsize=TEXTSIZE) disp.fill(scr)