Python wrapper for SR Research EyeLink eye trackers
Project description
PyeLink
Python wrapper for SR Research EyeLink eye trackers.
Installation
You must specify a backend when installing pyelink. A simple pip install pyelink will NOT work because pyelink requires one of three mutually exclusive display backends (pygame, psychopy, or pyglet).
Choose ONE backend:
# For Pygame users
pip install pyelink[pygame]
# For PsychoPy users (Python < 3.12 only)
pip install pyelink[psychopy]
# For Pyglet users (pyglet 2.0+)
pip install pyelink[pyglet]
You'll also need to install pylink separately from SR Research:
pip install --index-url=https://pypi.sr-support.com sr-research-pylink
Note: This codebase has been tested on macOS ARM (Apple Silicon) only.
⚠️ Backend Compatibility Warning
You CANNOT install both psychopy and pyglet backends together.
Why? PsychoPy pins pyglet==1.4.11 (from 2017) as a dependency, while the modern pyglet backend requires pyglet>=2.0.0. These versions are incompatible.
Solution: Choose ONE backend:
- Pygame (recommended): Works everywhere, no conflicts
- PsychoPy: Use if you need PsychoPy features, but cannot use pyglet 2.0+
- Pyglet: Use if you want modern pyglet (2.0+) but don't need PsychoPy
Platform-Specific Notes
macOS:
- PyAudio requires PortAudio. Install it first:
brew install portaudio
Quick Start
import pyelink as el
# Configure tracker with backend
settings = el.Settings(
backend='pygame', # or 'psychopy', 'pyglet'
fullscreen=True,
screen_width=1920,
screen_height=1080,
filename="mydata",
filepath="./data/",
)
# Tracker creates and owns the window
tracker = el.EyeLink(settings)
# Calibrate (optionally record samples during calibration)
tracker.calibrate(record_samples=True)
# Option A: Direct window access for custom drawing
tracker.window.fill((128, 128, 128)) # pygame example
# ... backend-specific drawing ...
tracker.flip()
# Option B: Helper methods for common patterns
tracker.show_message("Press SPACE to begin")
tracker.wait_for_key('space')
# Run your experiment
tracker.start_recording()
# ... show stimuli, collect data ...
tracker.stop_recording()
# Clean up (closes window and saves EDF automatically)
tracker.end_experiment()
Development
For development with different backends:
# PsychoPy backend
uv pip uninstall pyelink && uv pip install -e ".[psychopy]" && uv pip install --index-url=https://pypi.sr-support.com sr-research-pylink
# Pygame backend
uv pip uninstall pyelink && uv pip install -e ".[pygame]" && uv pip install --index-url=https://pypi.sr-support.com sr-research-pylink
# Pyglet backend
uv pip uninstall pyelink && uv pip install -e ".[pyglet]" && uv pip install --index-url=https://pypi.sr-support.com sr-research-pylink
Attribution
This package is based on code originally developed by:
-
Marcus Nyström (Lund University Humanities Lab, Lund, Sweden)
- Email: marcus.nystrom@humlab.lu.se
-
pylinkwrapper by Nick DiQuattro
- Repository: https://github.com/ndiquattro/pylinkwrapper
- Core EyeLink functionality and wrapper architecture
Acknowledgments
This project has received funding from the European Union's Horizon Europe research and innovation funding program under grant agreement No 101072410, Eyes4ICU project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyelink-1.0.0.tar.gz.
File metadata
- Download URL: pyelink-1.0.0.tar.gz
- Upload date:
- Size: 503.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a6f275b83fca8d5de821b9675033d6665f48419703a8636c0cf28f013a71327
|
|
| MD5 |
134ebe26e763853b889f483394af2033
|
|
| BLAKE2b-256 |
663a12d9635535235f56691be79079c4ed43ac5900398abb511e219ba91521b9
|
File details
Details for the file pyelink-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyelink-1.0.0-py3-none-any.whl
- Upload date:
- Size: 67.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d605d68ec8abf7d7fea4b5d9dea70283a2778a086d7eed05a063a55fde7086d
|
|
| MD5 |
080a0b5ce8440ae4a8e14bdec0683c67
|
|
| BLAKE2b-256 |
606bae4bb67a0eb5f0948c92858840d25223f430412357145679d4389a5dfac9
|