Hello Esther,
Yes, I’ve come up with a solution - though it’s not ideal.
Below is a short piece of code that connects to the Tobii glasses, starts recording, displays a black circle (for 4 seconds on my screen), sends two event messages to the tracker (1 second apart), and finally stops the recording.
from psychopy import core, visual, event
from g3pylib import connect_to_glasses
import asyncio
import logging
import time
win = visual.Window(color = 'gray', units = 'pix', size = [1000, 1000])
disc = visual.Circle(win, radius=80, fillColor = 'black', lineColor = 'black', pos = [0,0])
logging.basicConfig(level=logging.INFO)
async def main():
# Connect to Tobii Glasses3
glasses = await connect_to_glasses.with_hostname('tg03b-080202025311')
# await glasses.calibrate.emit_markers()
# await glasses.calibrate.run()
# start eyetracking recording
await glasses.recorder.start()
# loop for stimulus display
for frames in range (240):
disc.draw()
win.flip()
if frames == 120:
event_data = {"type": "event", "value": 1}
await glasses.recorder.send_event("message_1", event_data)
if frames == 180:
event_data = {"type": "event", "value": 2}
await glasses.recorder.send_event("message_2", event_data)
# breaking the loop
if event.getKeys('q'):
break
# stop eyetracking recording
await glasses.recorder.stop()
asyncio.run(main())
Although the event messages are saved they are not recognized by the Tobii Pro Lab when you import the recording to the software. Please see the attached screenshot.
Here is my solution. Please first look at the ‘syncport’ events in the eventdata folder (visible in the center of the screenshot) and in Tobii Pro Lab (visible in the lower right-hand corner of the screenshot). You’ll see that the first SyncPortOutHigh timepoint is 000.111, and the timestamp of the first syncport in the eventdata folder is 000.111132. This shows that the timestamps in the eventdata folder represent the actual event timepoints.
When you export the raw data from Tobii Pro Lab to a database (in this case, an Excel file), you’ll see the first syncport event at 111 under the ‘Recording timestamp [ms]’ column.
To combine my event messages with the eye-tracking gaze data database, I simply read the timepoints of my event messages from the eventdata folder (rounded to three decimal places) and add these messages to the database at the corresponding row in the ‘Recording timestamp’ column.
Hope that helps 
If you have any ideas on how to improve this, I’d be grateful for your thoughts!
Best,
@styrkowiec
Side note:
I wasn’t able to run the Tobii glasses calibration from the PsychoPy script level, so I used the Glasses 3 Controller for the calibration routine instead.
As you can see, the event messages are not exactly 1000 ms apart - probably due to some dropped frames.