Sample 08: Setting screen parameters at run time

What does this sample do?

In order to run GazeParser.TrackingTools, parameters in the configuration file have to be set properly. If you always run GazeParserTrackingTools under a single hardware setting, you don’t have to edit the configuration file over and over again. However, if you have to run GazeParser.TrackingTools switching multiple hardware settings, it would be really bothering you to edit configuration file.

In version 0.8.2, following methods are added to GazeParser.TrackingTools to reduce troubles concerning configuration.

getCameraImageSize() gets image size of the camera unit used by SimpleGazeTracker. Passing return value of getCameraImageSize() to setReceiveImageSize(), GazeParser.TrackingTools can run even if CAMERA_WIDTH and CAMERA_HEIGHT are not properly configure. fitImageBufferToTracker() do getCameraImageSize() and setReceiveImageSize() together.

Note that connect() have to be called before calling getCameraImageSize() or fitImageBufferToTracker() because they uses network connection to get information from SimpleGazeTracker.:

tracker.connect(info['Tracker IP address'])

setCurrentScreenParamsToConfig() inspects current screen settings and updates following parameters in GazeParser.Configuration.Config object.


On VisionEgg, physical screen size and viewing distance (in centimeter) have to be supplied as arguments of setCurrentScreenParamsToConfig(). On the other hand, on PsychoPy, these values are collected from MonitorInfo. If necessary, you can also give these values as arguments of this function.

Because setCurrentScreenParamsToConfig() accesses calibration screen object, setCalibrationScreen() have to be called in advance.:

# PsychoPy

# VisionEgg
tracker.setCurrentScreenParamsToConfig(GazeParser.config, screenSize, distance)