I have a strange issue which is reproducible on my machine (HP Precision T1600, Windows 10 64-bit):
I run the following basic code
from psychopy import visual, core
win = visual.Window()
core.wait(5)
In PsychoPy 1.85.6 this runs perfectly
In PsychoPy 1.90.0, 190 PY3, 1.90.1 and 1.90.1 PY3, the display turns dark after window creation and closure.
I have to enable and disable nightview in Windows 10 to get back to normal brightness.
Seems to be a bug in the 1.90 branch, independent from the Python version.
I think this is related to how the application closes now, as the window’s close() method is explicitly called at exit with a bunch of clean-up routines. For the pyglet graphics backend, it tries to restore the original gamma table before exiting. It’s possibly getting some incorrect table (a linear ramp?) on startup and setting it once you exit.
That might be an easy fix from my end. I can PM you a monkey patch once I figure it out.
Today, I get the following errors (without changing anything in the code) but after changing the luminance of the monitor:
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\visual\window.py", line 472, in close_on_exit
self.close()
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\visual\window.py", line 1124, in close
self.backend.close() # moved here, dereferencing the window prevents
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\visual\backends\pygletbackend.py", line 357, in close
self.gammaRamp = self._origGammaRamp
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\tools\attributetools.py", line 32, in __set__
newValue = self.func(obj, value)
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\visual\backends\pygletbackend.py", line 319, in gammaRamp
xDisplay=self.xDisplay)
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\visual\backends\gamma.py", line 91, in setGammaRamp
assert success, 'SetDeviceGammaRamp failed'
AssertionError: SetDeviceGammaRamp failed
Traceback (most recent call last):
File "C:\Program Files (x86)\PsychoPy2_PY3\lib\site-packages\psychopy\app\coder\coder.py", line 2889, in onURL
lineNumber = int(tmpLineNumber.split()[0])
ValueError: invalid literal for int() with base 10: '156,'
I think the xDisplay stuff is OK, the problem seems to be that the system call to set the gamma ramp is failing. I’ll see if I can find a Windows 10 machine to look into it.