Simple wrapper for Tobii Stream API (Windows Only).
- Cython:
pip install cython
- Clone this project
- Install Tobii Eye Tracking Core Software
- Download Stream Engine 3.3.0 for Windows x86 (it must be x86 even if you are using a 64-bit Windows because Python needs the 32-bit library), or the latest version available here
- Extract the files
- Move
tobii_stream_engine.dllandtobii_stream_engine.libfromlib/tobiito this project's root directory - Move
tobiidirectory fromincludeto this project'sincludedirectory - Run
python setup.py install
An example is provided in tobii_client_test.py.
api = tobii_client.TobiiAPI(gaze_callback)
api.start_stream()
time.sleep(1)
api.stop_stream()You can alternatively use the with statement, which will call start_stream() and stop_stream():
with tobii_client.TobiiAPI(gaze_callback) as api:
time.sleep(1)The TobiiAPI object requires a callback function with a single argument. The callback function will be called for every new gaze sample. The gaze sample is represented by a namedtuple with the following fields:
timestamp: integer timestamp value, as provided by Tobii Stream Enginevalid: boolean indicating whether this sample is valid or notx: float in range [0, 1] (normalized screen size)y: float in range [0, 1] (normalized screen size)