Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Eyetracking post-calibration problem with re-entering expyriment

Hello everyone,

I'm using expyriment together with pygaze. A snippet of my script looks like this.

from expyriment import design, control, stimuli, misc,io
import constants
from pygaze import libscreen, eyetracker, libgazecon
import pygame

disp        =   libscreen.Display(disptype=constants.DISPTYPE, dispsize=constants.DISPSIZE, fgc=constants.FGC, bgc=constants.BGC, screennr=constants.SCREENNR)
tracker     =   eyetracker.EyeTracker(disp, trackertype=constants.TRACKERTYPE, resolution=constants.DISPSIZE, saccvelthres=constants.SACCVELTHRESH, saccaccthresh=constants.SACCACCTHRESH)

expName="Encoding"
exp         =   design.Experiment(name=expName, filename_suffix=expName)
control.initialize(exp)

def calibrator(tracker):

        instro = stimuli.BlankScreen()
        stimuli.TextLine(u'Kalibrierung notwendig.', position = (0, 100), text_size = 40, text_bold = False).plot(instro)
        stimuli.TextLine(u'Mit "Leertaste" weiter', position = (0, 50 - exp.screen.size[1]/2), text_size = 25, text_bold = False).plot(instro)
        instro.present(clear = False)
        exp.keyboard.wait(misc.constants.K_SPACE) # Wait for space

        tracker.calibrate() # <--Calibration is executed here

calibrator(tracker) 
...

My problem: When I start the calibration (= calibrator function), a new window opens up where the calibration is performed. Afterwards I see the desktop but the pygame window of expyriment is not visible. If I go to the task manager, double click on the pygame window application, and then press enter, the expyriment window becomes visible on the screen with the ready screen (I'm quite sure that the enter-press is confirming the subject ID, though not visibly). The experiment then runs fluently and eye tracking works.
Thus, it seems that expyriment is continuing its processing after the calibration but does not automatically show the exp.screen surface.

Some info on my system:
I'm using Windows 7;
pygaze environment (http://www.pygaze.org/downloads/)
expyriment version 0.6.3
smi eye tracker

Comments

  • Mmh, this seems to be related to how Windows handles the Pygame window.

    If the calibrate method of the pygaze is blocking, then you could simply add a exp.screen.update() afterwards, to ensure a screen refresh in the Expyriment window.

    If the method is not blocking, you could move the calibration procedure to somewhere after expyriment.control.start(), and then just add an additional exp.keyboard.wait() before presenting anything meaningful (which will update the screen again).

    Florian Krause (Developer)
    http://www.expyriment.org

Sign In or Register to comment.