EyeLink Connector Class for Pygame and Pyglet
pylink is an awesome interface and offers great flexibility.
However, when setting up an eye-tracking application, you may want something with a bit higher-level interface.
Also, it seems it only supports calibration for the backends psychopy and pygame, and not for pyglet.
So, here we go: An EyeLink Connector Class developed for and tested on the EyeLink 1000+ with python>=3.10 on Windows.
Current limitations
- When performing a drift correction you have to manually check that "Apply Correction" is toggled 'on'
Installation
If you want to use it only for pygame, pyglet, OR psychopy see below.
Install the package
pip install pyelink-connector
If you want to install only the dependencies for pygame, pyglet or psychopy use the following command with only the one backend you need needed:
pip install pyelink-connector[<pygame|pyglet|psychopy>]
If you have no running pylink version for your EyeLink 1000 + yet, also see Installing pylink below.
Dependencies
The pylink_connector was built for the following packages
- pygame-ce==2.5.3
- pyglet==2.0.15
- psychopy==2024.2.4
... and should support new versions. Other versions might work as well.
It further requires software by SR-Research.
Installing pylink
System wide python
You can find some support for installing pylink for communicating with an EyeLink, for example, on the SR-Research forum.
I have not tested their suggestion, because I was using a conda python environment.
Using conda or other virtual python environments
When working with a conda environment, only installing pylink with pip to was not sufficient to communicate with the EyeLink 1000 + in my case. I figured out the following procedure to install pylink for communicating with an EyeLink
- Download and install the SR-Research development kit. You need to register an account to access the page.
- Create your conda environment with its own python version. For example
conda create -n eyeLinkEnv --python=3.12
- Activate it and install pylink with pip.
conda activate eyeLinnkEnv
pip install pylink
- Windows specific: Copy the pylink files that came with the development kit to the site-packages folder of pylink of your environment. You can adapt the example below to your needs.
Example:
Assuming
- you installed the SR development kit to C:\Program Files (x86)\SR Research\
- the python packages of your conda environment are located at C:\Users\USERNAME\.conda\envs\eyeLinkEnv\Lib\site-packages
- and you are using 3.12...
then you can copy the contents of C:\Program Files (x86)\SR Research\EyeLink\SampleExperiments\Python\64\3.12\pylink to C:\Users\USERNAME\.conda\envs\eyeLinkEnv\Lib\site-packages\pylink\
Usage
Minimum example with pygame
from pyelink_connector.pygameConnector.pygame import EyeConnector
settings = {
"render_fps": 60,
}
pygame.init()
surface = pygame.display.set_mode(depth=0, display=0, vsync=1, flags=pygame.FULLSCREEN)
eyeConnector = EyeConnector(win=surface, prefix="TEST")
eyeConnector.openFile(file_name="pga")
# Perform calibration and validation
eyeConnector.runSetup(settings=settings)
eyeConnector.startRecording(msg="test trial start")
# show your stimuli
...
eyeConnector.stopRecording()
eyeConnector.downloadFile()
eyeConnector.close()
You can find more examples for pygame, pyglet and psychopy on github.
Build locally
This package was build using 'python -m build.
Contact & Support
I am happy for any bug reports or feature requests! Please use github for these.
If the pyelink-connector was helpful to you and you feel like supporting, you are welcome to buy me a coffee or simply reach out and tell me how you made use of this package!
Metadata
Release files for pyelink-connector 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyelink_connector-0.2.4.tar.gz | 25.0 kB | Without provenance | Details for pyelink_connector-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyelink_connector-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for pyelink_connector-0.2.4-py3-none-any.whl |
Total release size: 49.9 kB
Release files / pyelink_connector-0.2.4.tar.gz
| Download URL | pyelink_connector-0.2.4.tar.gz |
|---|---|
| Size | 25.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e42e35872eb8f8bea78a16386ae25ef41a7d00932318f3cf64e1497e62deaaf3
|
|
BLAKE2b-256 checksum How to use checksums |
65b0b3c1a7ec5d98a5746fc6d6dc20a9c8338db08af7624a4d3911398fd98b40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / pyelink_connector-0.2.4-py3-none-any.whl
| Download URL | pyelink_connector-0.2.4-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29fe832999048b276003a83bba94230b02f56393ebf41ddb534d9e8233e058a4
|
|
BLAKE2b-256 checksum How to use checksums |
20dc8db5b3b9e5468db527faa5a400246d397751923ebeb4f5d50b8fe3850e84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for pyelink-connector 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.