code using get_texture:

welcome_logo = pyglet.image.load('./assets/images/welcome.png').get_texture()

code using Sprite:

welcome_logo = pyglet.image.load('./assets/images/welcome.png')
welcome_logo = pyglet.sprite.Sprite(welcome_logo)
welcome_logo.scale = 0.5

Traceback:

Traceback (most recent call last):
  File "main.py", line 35, in <module>
    main()
  File "main.py", line 29, in main
    window = Window(width=1200, height=750, caption='Pygros', resizable=False)
  File "D:\code\Pygros\main.py", line 14, in __init__
    super(Window, self).__init__(*args, **kwargs)
  File "C:\Users\chen\.virtualenvs\vv_310\lib\site-packages\pyglet\window\win32\__init__.py", line 104, in __init__
    super(Win32Window, self).__init__(*args, **kwargs)
  File "C:\Users\chen\.virtualenvs\vv_310\lib\site-packages\pyglet\window\__init__.py", line 578, in __init__
    self._create()
  File "C:\Users\chen\.virtualenvs\vv_310\lib\site-packages\pyglet\window\win32\__init__.py", line 258, in _create
    self.context.attach(self.canvas)
  File "C:\Users\chen\.virtualenvs\vv_310\lib\site-packages\pyglet\gl\win32.py", line 255, in attach
    super(Win32ARBContext, self).attach(canvas)
  File "C:\Users\chen\.virtualenvs\vv_310\lib\site-packages\pyglet\gl\win32.py", line 202, in attach
    raise gl.ContextException('Unable to share contexts.')

At first i thought it was something about my python version (cuz i just resetted my windows and upgraded to Python 3.11), so i tried Python 3.10 which worked fine before, neither worked

some says it's a problem with iris graphics card, but it worked fine before on the same hardware.

i wonder how to fix this

1

There are 1 best solutions below

0
arif hoq On

I solved it using my own approach. Initially, when I installed it using "pip install pyglet," it installed the latest version of pyglet, which was version 2.0.7. However, this version was not compatible with the graphics configuration of my laptop. So, I decided to install an older version of pyglet, specifically pyglet 1.5.0. After installing this version, the issue was resolved, and the program worked fine.

To install a specific version of pyglet,use: "pip install pyglet==1.5.0". You can also find a list of all pyglet versions at the following link: [https://pypi.org/project/pyglet/#history]