esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
677 stars 211 forks source link

Setting screen background color doesn't work as expected with PsychoPy #1

Closed smathot closed 11 years ago

smathot commented 11 years ago

I tried to create an alternating black and white background by alternately showing screens white and black:

black = libscreen.Screen(bgc=(0,0,0))
white = libscreen.Screen(bgc=(255,255,255))

This works with PyGame. However, with PsychoPy the background just stays gray. I ran into a similar issue with OpenSesame, and solved it by drawing a big rectangle for non-standard backgrounds, see https://github.com/smathot/OpenSesame/blob/master/openexp/_canvas/psycho.py#L137 (But let me know if you find a better way.)

esdalmaijer commented 11 years ago

You're right! I've used the same trick, actually, to avoid the problem.

Thing is that in libscreen.PsychoPyScreen.create the clear method (which clears the stimulus list and then adds a screensized rectangle) was not called properly (when None was passed for the 'screen' keyword argument, self.clear wasn't called). Obviously, the method should have been called upon creation of a new Screen in any case. I've fixed this and will commit the changes ASAP.

Thanks for pointing this out!

EDIT: see https://github.com/esdalmaijer/PyGaze/blob/master/pygaze-0.4/libscreen.py#L721