| Reference | Downloads | Github

Creating a transparent visual.Window possible

I am using psychopy for an eye tracking experiment and want to record the eye gaze while performing tasks in a specific programm. Is there a way to make a visual.Window transparent and use it as an invisible overlay over other programms?

I’m not sure about making a window invisible, but if you are using iohub to access the eye tracking device you do not need to have a psychopy window open at all while recording.

This example will print the current gaze position every 0.5 seconds until a key is pressed. The example uses the MouseGaze ‘eye tracker’, but any of the supported trackers could be used:

from psychopy import core, visual
from psychopy.iohub import launchHubServer

devices_config = dict()
eyetracker_config = dict(name='tracker')
eyetracker_config['calibration'] = dict(screen_background_color=[128, 128, 128])
devices_config['eyetracker.hw.mouse.EyeTracker'] = eyetracker_config

# create a *temp* window to tell iohub about the full screen window / monitor
# that will be tracked. This window is closed right after starting iohub
win = visual.Window((1920, 1080), units='pix', fullscr=True, allowGUI=False,
                    colorSpace='rgb255', monitor='55w_60dist', color=[128, 128, 128]

io = launchHubServer(window=win, **devices_config)

# Close the window used to tell iohub about the screen / display
# to be tracked

# Get some iohub devices for future access.
keyboard = io.getDevice('keyboard')
tracker = io.getDevice('tracker') # eye tracker

# Display eye tracker calibration gfx window and run calibration.
result = tracker.runSetupProcedure()

# start eye tracker recording, no psychopy window is open

atime = core.getTime()
while not keyboard.getKeys():
    if core.getTime()-atime > 0.5:
        print('gaze pos: ', tracker.getPos())
        atime = core.getTime()

# stop eye tracker recording

# stop iohub and quit psychopy runtime