Tobii and OpenSesame

Last modified by Iris Spruit on 2026/01/29 16:56

Information

Subpages

Introduction

Tobii communication in OpenSesame can be achieved with the Titta plugin or the PyGaze library. The Titta plugin seems a more stable and easy to use option than PyGaze.

Using the Titta plugin

The Titta plugin implements the Titta library in OpenSesame. It is very easy to use and works well with Tobii. To install, run pip install opensesame-plugin-titta-eyetracking in OpenSesame. Then, restart OpenSesame. The Titta plugin objects are now available. A demo experiment can be found here: opensesame-plugin-titta_eyetracking/demo_experiment

When you use Titta, make sure to cite it accordingly, see dev-jam/opensesame-plugin-titta_eyetracking.

The Titta library also provides examples for analyzing the gaze data (.h5 files). Make sure to follow the sample task and test out the whole analysis before starting data collection.

For analyzing pupil data, the PhysioData Toolbox can be used. The File Converter's Eye-Tracking TSV File Converter can be used to convert the tsv data files to PhysioData files.

See for more information on Titta:

Using PyGaze

PyGaze enables eye tracking with many eye trackers, including Tobii. PyGaze uses the Tobii Pro software development kit (SDK) to communicate with the Tobii eye tracker.

The PyGaze library is automatically installed with the OpenSesame Windows version. To work with Tobii, Python version 3.10 or 3.8 is required. For OpenSesame 4.0 and 3.3, OpenSesame can be run in its own Python 3.10 or 3.8 environment using Conda (see below). OpenSesame 4.1 does currently not work with PyGaze and Tobii.

More information on how to use PyGaze and a sample task can be found on our Github page and on the OpenSesame website.

Information

OpenSesame and PyGaze/Tobii at FSW Leiden

A Conda environment with OpenSesame 4 and OpenSesame 3 that comes with the Python version necessary for Pygaze with Tobii are installed on some lab pc's at FSW Leiden (Agora and Sylvius). Use the OpenSesame 4 - Tobii and OpenSesame 3 - Tobii shortcuts on the Desktop to open OpenSesame in these environments. See the main OpenSesame page for more information. Contact labsupport@fsw.leidenuniv.nl if you have trouble using these environments.

Note that launching the installed OpenSesame by running it from the start menu, or by double-clicking an osexp file, will not launch the OpenSesame version inside of the new environment. Instead, the OpenSesame version installed on the PC will launch in its own bundled Python runtime.

Installing and Running OpenSesame Through Conda

Conda is a package manager included in Anaconda and Miniconda. Please make sure one of the two is installed before attempting to use Conda. It is preferable to install Anaconda as it provides a handy graphical user interface and more features, although those are not required. Note that both Miniconda and Anaconda can be installed for the current user without admin privileges by choosing “just me” at the “install for” prompt.

To run OpenSesame through Conda for the purpose of using Tobii, a new Python environment must be created and configured. Subsequently, the OpenSesame code and all its dependencies must be downloaded and installed inside that environment.

Once the environment has been set up, the OpenSesame installed inside of it can be launched by first activating that environment, then running the opensesame command.

The above has been automated in a few scripts, see Github for more information.

If you want to create your own environment, see Managing environments — conda 24.5.1.dev56 documentation for more information on Conda and see Download // OpenSesame documentation (cogsci.nl) for more information on how to download OpenSesame in a Conda environment.

FAQ

TopicQuestionAnswer
OpenSesame crashes with AttributeError: 'TobiiProTracker' object has no attribute 't0' 

Make sure the eye tracker is connected properly to the pc and set-up with the Eye Tracker Manager. If this is the case, see below.

Somehow, the eye tracker is sometimes not found immediately. This is usually resolved by just running the task again. See discussion and solution here. The find_all_eyetrackers() function needs to be adjusted to solve the issue.