Пример #1
0
    def run(self):
        f = open("testeFile.txt", 'w')
        f.writelines(["ENTROU NO JOGO\n"])
        f.close()
        eyetracker = EyeTracker(disp)
        eyetracker.calibrate()
        disp.fill(screen)
        disp.show()

        self.reloadItems()
        running = True
        main_music = pygame.mixer.music.load("media/sounds/crimson.wav")
        pygame.mixer.music.set_volume(0.6)
        pygame.mixer.music.play()

        while running:
            self.canvas.clear()

            # Limit frame speed to 50 FPS
            self.clock.tick(50)
            for event in pygame.event.get():
                if (event.type
                        == pygame.QUIT) or ((event.type == pygame.KEYDOWN) and
                                            (event.key == pygame.K_ESCAPE)):
                    running = False

            # Redraw the background
            self.screen.fill(self.bg_color)
            # display.show()
            # Draw Menu Title

            title_x = self.scr_width / 2 - self.title.get_rect(
            ).width / 2  # screen.get_rect().width/2 - self.title.get_rect().width/2
            title_y = self.scr_height / 10  # .get_rect().height/10

            self.screen.blit(self.title, (title_x, title_y))

            # Menu Options

            for item in self.items:
                if item.is_mouse_over(pygame.mouse.get_pos()):
                    item.set_font_color((255, 0, 0))
                    if ((1, 0, 0) == pygame.mouse.get_pressed()):
                        if (item.index == 0):
                            print "loading "

                            if avalgame.isEnabled():
                                playercode = SetGamerId(self.canvas,
                                                        disp,
                                                        avalgame=avalgame)
                                self.canvas.clear()
                                playercode.run()
                                print("playercode START")
                                if avalgame._done:
                                    startGame = game.Game(self.canvas,
                                                          disp,
                                                          avalgame=avalgame)
                                    self.canvas.clear()
                                    startGame.run()
                                    print("GAME START")

                            else:
                                startGame = game.Game(self.canvas, disp)
                                self.canvas.clear()
                                startGame.run()
                                print("GAME START")
                        elif (item.index == 1):
                            print "settings"
                            settingsGame = GameSettings(self.canvas,
                                                        disp,
                                                        avalgame=avalgame)
                            self.canvas.clear()
                            settingsGame.run()
                            print("settings START")
                        elif (item.index == 2):
                            print("Saindo do jogo")
                            # log.close()
                            running = False
                        elif (item.index == 3):
                            if (self.lang == "pt"):
                                self.langButton.text = "Pt-BR"
                                self.labels = ["Start", "Settings", "Exit"]
                                self.lang = "en"
                                self.reloadItems()
                                pygame.mouse.set_pos(
                                    self.screen.get_rect().width / 2,
                                    self.screen.get_rect().height / 2 - 30)
                            else:
                                self.langButton.text = "En-US"
                                self.labels = [
                                    "Iniciar", "Configuracoes", "Sair"
                                ]
                                self.lang = "pt"
                                self.reloadItems()
                                pygame.mouse.set_pos(
                                    self.screen.get_rect().width / 2,
                                    self.screen.get_rect().height / 2 - 30)
                else:
                    item.set_font_color((255, 255, 255))

                self.screen.blit(item.label, item.position)

            # Draw version
            version_x = self.screen.get_rect().width - self.version.get_rect(
            ).width
            version_y = self.screen.get_rect().height - self.version.get_rect(
            ).height
            self.screen.blit(self.version, (version_x, version_y))

            # Draw languageButton

            self.screen.blit(self.langButton.label, self.langButton.position)

            ############ DISPLAY ##############
            # pygame.display.flip()
            x, y = eyetracker.sample()

            self.canvas.draw_circle(colour=(255, 0, 0),
                                    pos=(x, y),
                                    r=5,
                                    fill=True)
            disp.fill(self)
            disp.show()
Пример #2
0
    def run(self):
        eyetracker = EyeTracker(disp)
        eyetracker.calibrate()

        running = True

        self.textinput = text_input.TextInput(text_color=(255, 255, 255),
                                              cursor_color=(255, 255, 255),
                                              literal_number=True)
        if self.avalgame._code is not None:
            self.textinput.input_string = str(self.avalgame._code)
            self.textinput.cursor_position = len(str(self.avalgame._code))

        self.text1 = self.textFont.render("Configuracoes", 1, (255, 255, 255))
        self.text2 = self.textFont.render("Codigo do jogo", 1, (255, 255, 255))
        #pygame.display.update()
        self.screen.fill(self.bg_color)
        self.screen.blit(self.text1, (380, 250))
        self.screen.blit(self.text2, (380, 300))
        exitLabel = self.exitFont.render("ESC para sair", 1, (255, 255, 255))
        self.screen.blit(exitLabel, (0, 650))
        self.logTheData()
        self.buttonOk.set_position(380, 400)
        self.buttonCancel.set_position(450, 400)

        while (running):
            clock.tick(60)
            self.screen.fill(self.bg_color)
            self.screen.blit(self.text1, (380, 250))
            self.screen.blit(self.text2, (380, 300))
            exitLabel = self.exitFont.render("ESC para sair", 1,
                                             (255, 255, 255))
            self.screen.blit(exitLabel, (0, 650))

            events = pygame.event.get()

            self.textinput.update(events)
            self.screen.blit(self.textinput.get_surface(), (380, 350))
            pygame.display.update()

            if self.buttonOk.is_mouse_over(pygame.mouse.get_pos()):
                self.buttonOk.set_font_color((255, 0, 0))
                if ((1, 0, 0) == pygame.mouse.get_pressed()):
                    if self.textinput.get_text() != '':
                        self.avalgame.install(True,
                                              int(self.textinput.get_text()))
                    else:
                        self.avalgame.install(False, 0)

                    running = False
            else:
                self.buttonOk.set_font_color((255, 255, 255))

            if self.buttonCancel.is_mouse_over(pygame.mouse.get_pos()):
                self.buttonCancel.set_font_color((255, 0, 0))
                if ((1, 0, 0) == pygame.mouse.get_pressed()):
                    running = False
            else:
                self.buttonCancel.set_font_color((255, 255, 255))

            for event in events:
                if (event.type == pygame.QUIT or event.type == pygame.KEYDOWN):
                    if (event.key == pygame.K_ESCAPE):
                        #print(self.textinput.get_text())
                        running = False

            self.screen.blit(self.buttonOk.label, self.buttonOk.position)
            self.screen.blit(self.buttonCancel.label,
                             self.buttonCancel.position)

            x, y = eyetracker.sample()
            self.canvas.draw_circle(colour=(255, 0, 0),
                                    pos=(x, y),
                                    r=5,
                                    fill=True)

            self.disp.fill(self)
            self.disp.show()
Пример #3
0
	# start tracking
	tracker.start_recording()
	tracker.log("SACC_TRIALSTART")
	
	# draw first screen
	disp.fill(sacscr[0])
	t0 = disp.show()
	tracker.log("fixation_on")
	
	# wait for a bit
	clock.pause(ITI)
	
	# wait until the cross is fixated
	fixated = False
	while not fixated:
		gazepos = tracker.sample()
		if ((gazepos[0]-int(DISPSIZE[0]*0.25))**2 + (gazepos[1]-int(DISPSIZE[1]*0.5))**2)**0.5 < 60:
			fixated = True
	
	# show target
	disp.fill(sacscr[1])
	t1 = disp.show()
	tracker.log("target_on")
	
	# wait until the target is fixated
	fixated = False
	while not fixated:
		gazepos = tracker.sample()
		if ((gazepos[0]-int(DISPSIZE[0]*0.75))**2 + (gazepos[1]-int(DISPSIZE[1]*0.5))**2)**0.5 < 60:
			fixated = True
	
Пример #4
0
# 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
	t0 = libtime.get_time()
	tstim = libtime.get_time()
	while libtime.get_time() - t0 < GAMEDURATION:
		# get gaze position
		gazepos = eyetracker.sample()
		# get keypress
		key, presstime = keyboard.get_key()
		# handle input
		if key:
			if key == 'escape':
				break
			if ((gazepos[0]-stimpos[0])**2 + (gazepos[1]-stimpos[1])**2)**0.5 < STIMSIZE/2:
				screen.copy(hitscreen)
				points += PPH
			else:
				screen.copy(misscreen)
				points += PPM
		else:
			screen.copy(blankscreen)
		# draw stimulus
Пример #5
0
# 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
	t0 = libtime.get_time()
	tstim = libtime.get_time()
	while libtime.get_time() - t0 < GAMEDURATION:
		# get gaze position
		gazepos = eyetracker.sample()
		# get keypress
		key, presstime = keyboard.get_key()
		# handle input
		if key:
			if key == 'escape':
				break
			if ((gazepos[0]-stimpos[0])**2 + (gazepos[1]-stimpos[1])**2)**0.5 < STIMSIZE/2:
				screen.copy(hitscreen)
				points += PPH
			else:
				screen.copy(misscreen)
				points += PPM
		else:
			screen.copy(blankscreen)
		# draw stimulus
Пример #6
0
    def run(self):
        dt = datetime.now()
        #Eye tracker configure
        eyetracker = EyeTracker(self.disp)
        eyetracker.calibrate()
        self.disp.fill(self.canvas)
        self.disp.show()
        #self.disp.mousevis = True

        eyetracker.start_recording()

        etObject = objects.EyeTracker(0, 0, 20, 20)

        ##END

        main_music = pygame.mixer.music.load("media/sounds/megalovania.wav")
        pygame.mixer.music.play()

        pygame.mixer.music.set_volume(0.6)

        bob = self.player

        # List to hold all the sprites
        all_sprite_list = pygame.sprite.Group()

        # Make the walls. (x_pos, y_pos, width, height)
        wall_list = pygame.sprite.Group()

        # List of Foods
        food_list = pygame.sprite.Group()

        wall = objects.Wall("", 0, 40, 10, 560, 1)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 10, 40, 980, 10, 1)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 990, 40, 10, 560, 1)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 10, 590, 980, 10, 1)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        ## Gondulas
        wall = objects.Wall("", 100, 200, 226, 40, 8)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 100, 400, 226, 40, 8)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 620, 200, 226, 40, 8)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 620, 400, 226, 40, 8)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        wall = objects.Wall("", 450, 220, 40, 226, 9)
        wall_list.add(wall)
        all_sprite_list.add(wall)
        obstacles.append(wall)

        ## ATM
        atm_list = pygame.sprite.Group()
        atm = objects.ATM("", 940, 45, 13, 35, 1)
        atm_list.add(atm)
        all_sprite_list.add(atm)

        ## Monsters
        monster_list = pygame.sprite.Group()

        fFood = objects.FastFood("", 850, 400, 30, 30, 3)
        monster_list.add(fFood)
        all_sprite_list.add(fFood)

        fFood2 = objects.FastFood("", 500, 130, 30, 30, 3)
        monster_list.add(fFood2)
        all_sprite_list.add(fFood2)

        fFood = objects.FastFood("", 270, 100, 30, 30, 3)
        monster_list.add(fFood)
        all_sprite_list.add(fFood)

        fFood = objects.FastFood("", 220, 450, 30, 30, 3)
        monster_list.add(fFood)
        all_sprite_list.add(fFood)

        fFood = objects.FastFood("", 450, 470, 30, 30, 4)
        monster_list.add(fFood)
        all_sprite_list.add(fFood)

        ##
        bob.walls = wall_list
        all_sprite_list.add(bob)

        bob.updateValues()
        #pygame.draw.rect(self.screen, (255,0,0) ,((bob.position),(bob.collisionWidth, bob.collisionHeight)),0)

        for wall in obstacles:
            pygame.draw.rect(self.screen, (0, 0, 0), wall.rect, 0)

        time_decrement = pygame.USEREVENT + 1
        T1 = 1000  # second
        pygame.time.set_timer(time_decrement, T1)

        card_generator = pygame.USEREVENT + 2
        T2 = 4000  # 4 second
        pygame.time.set_timer(card_generator, T2)

        monster_move = pygame.USEREVENT + 3
        T3 = 100  # 0,1 second
        pygame.time.set_timer(monster_move, T3)

        food_time = pygame.USEREVENT + 4
        T4 = 8000  # 8 seconds
        pygame.time.set_timer(food_time, T4)

        eyeTracker_time = pygame.USEREVENT + 5
        T5 = 1000  # 1 seconds
        pygame.time.set_timer(eyeTracker_time, T5)

        logRecord_time = pygame.USEREVENT + 6
        T6 = 1000  # 1 seconds
        pygame.time.set_timer(logRecord_time, T6)

        #gravar tempo que comeca uma fixacao
        logRecord_fixation = pygame.USEREVENT + 7
        T7 = 1000  #2seconds
        pygame.time.set_timer(logRecord_fixation, T7)

        cards_hit_list = pygame.sprite.spritecollide(bob, cards_list, False)

        bground = BackGround(self.screen)

        cont_blinks = 0
        gameRunning = True
        staring = False
        position = 0

        blinkCount = 0
        lastBlinkPos = (0, 0)

        x = random.randint(50, 800)
        y = random.randint(50, 400)
        cash = objects.Cash("", x, y, 20, 20, 2)
        cards_list.append(cash)
        pygame.draw.rect(self.screen, (0, 255, 0), cash.rect, 0)
        all_sprite_list.add(cash)

        #comeco do game
        while (gameRunning):

            self.canvas.clear()
            self.screen.fill((255, 255, 255))
            self.screen.blit(self.image, (0, 40))
            clock.tick(60)

            cards_hit_list = pygame.sprite.spritecollide(
                bob, cards_list, False)
            monster_hit_list = pygame.sprite.spritecollide(
                bob, monster_list, False)
            atm_hit_list = pygame.sprite.spritecollide(bob, atm_list, False)
            food_hit_list = pygame.sprite.spritecollide(bob, food_list, False)

            etSawList = pygame.sprite.spritecollide(etObject, food_list, False)

            if (len(etSawList) == 0):
                staring = False

            for atm in atm_hit_list:
                if (bob.direction == "up"):
                    bob.rect.top = atm.rect.bottom
                elif (bob.direction == "right"):
                    bob.rect.right = atm.rect.left
                elif (bob.direction == "left"):
                    bob.rect.left = atm.rect.right

            for monster in monster_hit_list:
                pygame.mixer.music.fadeout(1000)
                pygame.mixer.Sound.play(go_sound)
                pygame.time.delay(3500)

                gameRunning = False

            for card in cards_hit_list:
                bob.c_card += 1
                pygame.mixer.Sound.play(card_sound)
                cards_list.remove(card)
                all_sprite_list.remove(card)
                #self.avalgame.storeCreditCollection(self.startTime)

            for food in food_hit_list:
                if (event.type == pygame.KEYDOWN
                        and event.key == pygame.K_RETURN
                        and bob.cash >= food.value):
                    bob.buyFood(food)
                    food_list.empty()
                    self.player.total_produtos += 1
                    if (bob.score >= 10):
                        gameRunning = False

            #####  FRAME EVENTS
            ## Time Decrementer
            for event in pygame.event.get():
                if (event.type == time_decrement):
                    bob.time -= 1

                if (event.type == eyeTracker_time):
                    #verificar se houve fixacao
                    time = libtime.get_time()
                    getX, getY = eyetracker.sample()
                    self.dataStore.get_quadrant((getX, getY))
                    self.dataStore.start_fixation((getX, getY))

                if (event.type == logRecord_time):
                    etObject.setPosition(eyetracker.sample())
                    for food in etSawList:
                        self.dataStore.start_staring(food.food_type)

                if (event.type == MOUSEBUTTONDOWN):
                    start_time = eyetracker.wait_for_event(3)
                    time_end = eyetracker.wait_for_event(4)
                    #     cont_blinks += 1
                    self.dataStore.start_blinking(str(cont_blinks), start_time,
                                                  time_end)

                    tracker_pos = eyetracker.sample()
                    if (tracker_pos != lastBlinkPos):
                        self.dataStore.start_blinkingTest(
                            lastBlinkPos, blinkCount)
                        lastBlinkPos = tracker_pos
                        blinkCount = 1
                    else:
                        blinkCount += 1

                if (event.type == food_time):
                    food_list.empty()
                    newFood1 = objects.Food(5, "vegetal")
                    food_list.add(newFood1)

                    newFood2 = objects.Food(5, "carbohidrato")
                    food_list.add(newFood2)

                    newFood3 = objects.Food(5, "doce")
                    food_list.add(newFood3)

                    newFood4 = objects.Food(5, "proteina")
                    food_list.add(newFood4)

                ## Credit Card Generator
                if (event.type == card_generator and len(cards_list) < 2):
                    cashGenerator = random.randint(0, 100)
                    if (cashGenerator <= 25):
                        x = random.randint(50, 800)
                        y = random.randint(50, 400)
                        cash = objects.Cash("", x, y, 20, 20, 2)
                        cards_list.append(cash)
                        pygame.draw.rect(self.screen, (0, 255, 0), cash.rect,
                                         0)
                        all_sprite_list.add(cash)

                ## Monster Movement
                if (event.type == monster_move):
                    for monster in monster_list:
                        monsterCollision = pygame.sprite.spritecollide(
                            monster, wall_list, False)
                        if (monster.movingPositive):
                            if (len(monsterCollision) == 0):
                                if monster.obj_type == 4:
                                    monster.rect.left -= 15
                                else:
                                    monster.rect.top -= 15
                            else:
                                if monster.obj_type == 4:
                                    monster.rect.right += 15
                                    monster.movingPositive = False
                                else:
                                    monster.rect.bottom += 15
                                    monster.movingPositive = False
                        else:
                            if (len(monsterCollision) == 0):
                                if monster.obj_type == 4:
                                    monster.rect.right += 15
                                else:
                                    monster.rect.bottom += 15
                            else:
                                if monster.obj_type == 4:
                                    monster.rect.left -= 15
                                    monster.movingPositive = True
                                else:
                                    monster.rect.top -= 15
                                    monster.movingPositive = True

                ## Player Input
                if (event.type == pygame.KEYDOWN):
                    pygame.event.set_blocked(pygame.KEYDOWN)
                    if (event.key == pygame.K_ESCAPE):
                        gameRunning = False
                    elif (event.key == pygame.K_UP):
                        bob.acceleration = 5
                        bob.direction = "up"

                    elif (event.key == pygame.K_DOWN):
                        bob.acceleration = 5
                        bob.direction = "down"

                    elif (event.key == pygame.K_LEFT):
                        bob.acceleration = 5
                        bob.direction = "left"

                    elif (event.key == pygame.K_RIGHT):
                        bob.acceleration = 5
                        bob.direction = "right"

                    elif (event.key == pygame.K_RETURN):
                        if (dist(bob.rect.x, bob.rect.y, atm.rect.x,
                                 atm.rect.y) <= 65 and bob.c_card >= 1):
                            pygame.mixer.Sound.play(cash_sound)
                            bob.c_card -= 1
                            bob.cash += 15
                            self.player.cashTotal += 15

                if (event.type == pygame.KEYUP):
                    bob.acceleration = 0
                    pygame.event.set_allowed(pygame.KEYDOWN)

            bob.updateValues()

            if (bob.direction == "up"):
                bob.moveUp()
            elif (bob.direction == "down"):
                bob.moveDown()
            elif (bob.direction == "left"):
                bob.moveLeft()
            elif (bob.direction == "right"):
                bob.moveRight()

            if bob.time <= 0:
                gameRunning = False

            all_sprite_list.update()
            all_sprite_list.draw(self.screen)
            food_list.draw(self.screen)

            self.screen.blit(bob.timeLabel, (450, 0))

            # Player Interface Draw
            cash_x = 0
            cash_y = 20

            self.screen.blit(bob.cashLabel, (cash_x, cash_y))

            cCard_x = 0
            cCard_y = 0

            self.screen.blit(bob.c_cardLabel, (cCard_x, cCard_y))

            self.screen.blit(bob.scoreLabel,
                             (1000 - bob.scoreLabel.get_rect().width - 50, 0))

            ##BARS

            self.screen.blit(bob.carboLabel, (55, 610))
            self.screen.blit(bob.vegLabel, (30, 640))
            self.screen.blit(bob.protLabel, (565, 610))
            self.screen.blit(bob.doceLabel, (500, 640))

            self.progressBars(bob)

            ##Display
            #pygame.display.flip()
            self.disp.fill(self.canvas)
            self.disp.show()

        pygame.event.set_allowed(pygame.KEYDOWN)
        pygame.mixer.music.fadeout(1000)
        pygame.mixer.music.load("media/sounds/crimson.wav")
        pygame.mixer.music.play()

        pyramidCompletion = 0.0
        if (self.player.doce == 10):
            pyramidCompletion += 2.5
        if (self.player.proteina == 20):
            pyramidCompletion += 2.5
        if (self.player.vegetal == 30):
            pyramidCompletion += 2.5
        if (self.player.carbohidrato == 40):
            pyramidCompletion += 2.5

        self.avalgame.storePyramidCompletion(self.startTime,
                                             valor_AEEJ=pyramidCompletion)

        foodTotal = 0
        if (0 < self.player.total_produtos <= 5):
            foodTotal = 1
        elif (5 < self.player.total_produtos <= 10):
            foodTotal = 2
        elif (self.player.total_produtos > 10):
            foodTotal = 3
        self.avalgame.storeFoodQuantity(self.startTime, valor_AEEJ=foodTotal)

        if self.player.cashTotal == 0:
            averageScore = 0
        else:
            averageScore = float(
                float(self.player.total_produtos) /
                float(self.player.cashTotal)) * 100

        self.avalgame.storeAverageScore(self.startTime,
                                        valor_AEEJ=averageScore)

        self.dataStore.start_blinkingTest(lastBlinkPos, blinkCount)
        self.dataStore.log_gen.recordBlinkLog(self.dataStore.blink_log,
                                              'blink-', 4,
                                              self.avalgame._playerCode)
        self.dataStore.log_gen.recordLog(self.dataStore.blink_log2, 'blink2-',
                                         4, self.avalgame._playerCode)
        self.dataStore.log_gen.recordLog(self.dataStore.staring_log,
                                         'products-', 3,
                                         self.avalgame._playerCode)
        self.dataStore.log_gen.recordLog(self.dataStore.quadrant_log,
                                         'quadrants', 2,
                                         self.avalgame._playerCode)
        self.dataStore.log_gen.recordLog(self.dataStore.position_log,
                                         'fixation-', 1,
                                         self.avalgame._playerCode)
        self.avalgame.recordBestScore(self.player.time, self.player.score)

        ge = GameEnd(self.canvas, self.disp)

        ge.defScore(bob.score)
        ge.defResult(bob.score)
        #ge.storeData(etObject.log)
        #ge.storeData2(etObject.log2)
        #ge.storeDataBlink(etObject.log_blink)
        #ge.storeDataFixation(etObject.log_fixation)

        ge.run()
Пример #7
0
    tracker.start_recording()
    tracker.log("TRIALSTART %d" % trialnr)
    tracker.log("IMAGENAME %s" % images[trialnr])
    tracker.status_msg("trial %d/%d" % (trialnr + 1, ntrials))

    # present image
    disp.fill(scr)
    t0 = disp.show()
    tracker.log("image online at %d" % t0)

    is_found = 1
    # wait for a bit for participant viewing image
    while key != 'space':
        # check for key input
        key, presstime = kb.get_key(keylist=['space'], timeout=1)
        gaze_pos = tracker.sample()
        gaze_time = timer.get_time() - t0
        if aoi.contains(gaze_pos):
            print(gaze_pos)
            log.write([
                trialnr, images[trialnr], gaze_pos[0], gaze_pos[1], gaze_time
            ])
        if timer.get_time() - t0 >= TRIALTIME_L:
            is_found = 0
            break
    log_sub.write([ntrials, images[trialnr], is_found, timer.get_time() - t0])
    # reset screen
    disp.fill()
    t1 = disp.show()
    tracker.log("image offline at %d" % t1)