python-3.x 我无法在pyglet中创建窗口

e5nszbig  于 2023-05-02  发布在  Python
关注(0)|答案(1)|浏览(214)

我刚刚在我的机器上安装了pyglet。但我似乎无法创建一个窗口
我是这么做的

import pyglet 

window = pyglet.window.Window()

pyglet.app.run()

当我运行的时候它会给我这个错误

Traceback (most recent call last):
  File "c:/Users/Public/Documents/vscode/python/Games/Pyglet/main.py", line 3, in <module>
    window = pyglet.window.Window()
  File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 132, in __init__
    super(Win32Window, self).__init__(*args, **kwargs)
  File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\__init__.py", line 648, in __init__
    self._create()
  File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 274, in _create
    self.context.attach(self.canvas)
  File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\gl\win32.py", line 238, in attach
    raise gl.ContextException('Unable to share contexts.')
pyglet.gl.ContextException: Unable to share contexts.
kgsdhlau

kgsdhlau1#

也许这将帮助某人,我在一些论坛搜索了过去2天,似乎有一个问题,英特尔高清4000,它有点打破了小矮人。下面是我找到的解决方案,只需更改“\gl\win32.Py”对于这个:

def create_context(self, share):
if wgl_info.have_extension('WGL_ARB_create_context') and gl_info.get_vendor() != 'Intel':
return Win32ARBContext(self, share)
else:
return Win32Context(self, share)

希望能成功!!

相关问题