At the end of the routine I do
win.getMovieFrame(buffer = 'front')
filename = os.path.join(session_folder, f'trial_{trial_counter}.png')
win.saveMovieFrames(filename)
But it gives me a black screen for each trial, presumably taking a screenshot of the eye tracker screen (which is black) and not the host pc with the stimuli. How do I fix this?
It’s also a black screen when connected to eye tracker but in dummy mode
I note that you have misspelled getMovieFrame. Please check your original code.
Ha good catch, it is spelled correctly in the paradigm unfortunately. I’ll fix that now in the question. The screenshot mechanism works on laptops not connected to the eye tracker but if it’s connected to the eye tracker at all it’s black
It’s tied to the PsychoPy window (note that it is win.getMovieFrame) in principle, so it should show whatever is in the PsychoPy window. This is a very weird behavior, however. The only thing I can think of that would get you a black screen and not an error is if the eye-tracker opens another window, it’s possible that clears the front buffer the pyglet window is trying to access for the screenshot, or if you are capturing the screen before win.flip() has been called.
The slightly kludgy solution is to call win.getMovieFrame(buffer='back')
right before you call win.flip()
, which should avoid any interference from the eye-tracker.
I don’t call win.flip() on the end routine, should I be doing this? Thank you for your help
Actually, if it’s in builder this might not be possible. The each frame code is executed before the window is flipped, but because the elements all use autodraw, they won’t be on the back buffer either. The oddity is that the front buffer seems to get cleared.
@jon any ideas about whether pyglet is dumping its buffer here and if so how to get around it?