Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Using Pygaze without libscreen in a Java application

edited October 2015 in PyGaze


I would like to use PyGaze for tracking the coordinates and timings of users' gaze movements with an experiment GUI environment programmed in Java. Is there any way I can track the gaze behaviour without using a visible PsychoPy or Pygame window (e.g. is it possible to set the libscreen to transparent or invisible in order to show the java GUI behind)?

Thank you, Anna


  • edited 5:12PM

    Hi Anna,

    The short answer is no, unfortunately not. The EyeTracker class requires an active Display to present calibration targets on. It would require a major overhaul to separate the two. We might do this in the future, as you're not the first to ask, but I'm not expecting it happening anytime soon.

    You could try a little hack, though: launching a PyGame window, and then minimising (or 'iconifying' it in PyGame lingo) this.

    Provided DISPTYPE = 'pygame', the following is an example of what I mean:

    from pygaze.display import Display
    from pygaze.eyetracker import EyeTracker
    import pygame.display
    disp = Display()
    tracker = EyeTracker(disp)

    However, there remains the issue that the window becomes inactive. I'm not sure what this will do with the underlying processes that handle the tracker. If the sampling and logging still works, you're sorted.

    In addition, you might have to find a way to send the incoming gaze samples to your Java application if you want to make that gaze contingent. I'd suggest setting up a server within your Python script, and a client within Java, so you can exchange samples.

    Good luck!

Sign In or Register to comment.