In pyglet, which I’m learning, Image.blit() works, but Sprite.draw() doesn’t, nor Batch.draw(), even in this simple code:
import pyglet
win = pyglet.window.Window()
img = pyglet.resource.image('test.png')
spr = pyglet.sprite.Sprite(img)
@win.event
def on_draw():
win.clear()
spr.draw()
if __name__ == '__main__':
pyglet.app.run()
The window remains black. However, I can draw labels, for example.
THe only explaination I found was about graphic cards and “v2i” bugs with some of them, but I’m afraid to touch at pyglet’s code without really knowing what I’m doing.
The third answer of this thread worked for me, even though I’m using Ubuntu and not Windows. It’s actually a hardware problem. I replaced the “i” with the “f” at lines 368 and 372 in “v2i” in a file I found at /usr/lib/pymodules/python2.7/pyglet/sprite.py. Then I saved, ran my code, and everything was working.