I am getting a “not implemented error” for configs=self.get_matching_configs(template) when trying to get Psychopy version 1.84 going on my Windows 7 machine. Any suggestions?
I think the fix is that you can replace super(etc.) with super() when going from python 2 to python 3.
And that actually did not fix it.
Paste in the whole error message to give us a chance, and brief snippets of any relevant code. Nobodya can help with your current level of detail.
Hi Jon,
Thank you for the reply.
I think the problem is at _get_pixel_format_descriptor_matching_configs(self, canvas):, which gets matching configs using the PIXELFORMATDESCRIPTOR technique.
I can comment pf and return [] at the end of the
_get_pixel_format_descriptor_matching_configs def, but I think that bypasses the problem, and leads to the error that I showed you yesterday.
The problem is that I can not find the PIXELFORMATDESCRIPTOR info. I can set up a PIXELFORMATDESCRIPTOR structure, but byrefs expects a ctype instance. Converting a structure to a ctype is complicated, so I am lost.
The error message is below (1), and the relevant code is below that (2).
Thank you for your help,
Nathan
…
- Error message
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 102, in execfile
print(filename)
File “C:/Users/1523053295E/Desktop/WinPython-64bit-3.5.3.1Qt5/AVdemo.py”, line 18, in
disp = window(size=DISPSIZE, units=‘pix’, color = BGC, fullscr=False)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\visual\window.py”, line 343, in init
self._setupGL()
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\visual\window.py”, line 1552, in _setupGL
self._setupPyglet()
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\visual\window.py”, line 1378, in _setupPyglet
defDisp = psychopy.pyglet.window.get_platform().get_default_display()
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet_init_.py”, line 357, in getattr
import(import_name)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\window_init_.py”, line 1818, in
gl._create_shadow_window()
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\gl_init_.py”, line 205, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\window\win32_init_.py”, line 131, in init
super().init(*args, **kwargs)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\window_init_.py”, line 506, in init
config = screen.get_best_config(template_config)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\canvas\base.py”, line 161, in get_best_config
configs = self.get_matching_configs(template)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\canvas\win32.py”, line 33, in get_matching_configs
configs = template.match(canvas)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\gl\win32.py”, line 32, in match
return self._get_pixel_format_descriptor_matching_configs(canvas)
File “C:\Users\1523053295E\Desktop\WinPython-64bit-3.5.3.1Qt5\psychopy\pyglet\gl\win32.py”, line 91, in _get_pixel_format_descriptor_matching_configs
pf = _gdi32.ChoosePixelFormat(canvas.hdc, byref(pfd)) #pfd
TypeError: byref() argument must be a ctypes instance, not ‘PIXELFORMATDESCRIPTOR’
- Relevant code
def _get_pixel_format_descriptor_matching_configs(self, canvas):
’’‘Get matching configs using standard PIXELFORMATDESCRIPTOR
technique.’’’
# element.PIXELFORMATDESCRIPTOR.from_buffer(Record)
PIXELFORMATDESCRIPTOR=ctypes.POINTER(LP_PIXELFORMATDESCRIPTOR)
pfd = PIXELFORMATDESCRIPTOR()
# pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
pfd.nVersion = 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL
if self.double_buffer:
pfd.dwFlags |= PFD_DOUBLEBUFFER
else:
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE
if self.stereo:
pfd.dwFlags |= PFD_STEREO
else:
pfd.dwFlags |= PFD_STEREO_DONTCARE
'''Not supported in pyglet API
if attributes.get('swap_copy', False):
pfd.dwFlags |= PFD_SWAP_COPY
if attributes.get('swap_exchange', False):
pfd.dwFlags |= PFD_SWAP_EXCHANGE
'''
if not self.depth_size:
pfd.dwFlags |= PFD_DEPTH_DONTCARE
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = self.buffer_size or 0
pfd.cRedBits = self.red_size or 0
pfd.cGreenBits = self.green_size or 0
pfd.cBlueBits = self.blue_size or 0
pfd.cAlphaBits = self.alpha_size or 0
pfd.cAccumRedBits = self.accum_red_size or 0
pfd.cAccumGreenBits = self.accum_green_size or 0
pfd.cAccumBlueBits = self.accum_blue_size or 0
pfd.cAccumAlphaBits = self.accum_alpha_size or 0
pfd.cDepthBits = self.depth_size or 0
pfd.cStencilBits = self.stencil_size or 0
pfd.cAuxBuffers = self.aux_buffers or 0
return []
#^$ byref(pfd)=cast(byref(pfd),ctypes.byref(pfd))
# print(byref(pfd))
# x = (ctypes.LP_PIXELFORMATDESCRIPTOR)()
#print(x)
cast(LP_PIXELFORMATDESCRIPTOR,POINTER(PIXELFORMATDESCRIPTOR))
# backends = POINTER(POINTER(pfd))()
# pixelFormat = windll.gdi32.ChoosePixelFormat(canvas.hdc, byref(pfd))
# pfd=ctypes.POINTER(pfd)
#$3 print(pfd)
pf = _gdi32.ChoosePixelFormat(canvas.hdc, byref(pfd)) #pfd
From the filenames it looks like you’re using an incompatible python installation (64bit python 3.5?). We can’t support that I’m afraid. Install the Standalone app instead please