I have a problem with pyglet on one of my notebooks. I'm working on a relatively complex 2D-Game but it occurs even with the most minimalistic pyglet application you can imagine:
import pyglet
if __name__ == '__main__':
window = pyglet.window.Window(width=100, height=100)
window.clear()
ball_img = pyglet.image.load('ball.gif')
ball = pyglet.sprite.Sprite(ball_img)
@window.event
def on_draw():
ball.draw()
pyglet.app.run()
It should display an image of a ball like this:
But what it's drawing is a somehow stretched image:
If I replace ball.draw()
with ball_img.blit(0, 0, 0)
it gets rendered as expected.
The notebook is a small Thinkpad X40 running Linux (Intel integrated graphics).
How can such a behaviour be 开发者_如何学编程caused or what is likely to be causing this?
On my laptop (Ubuntu 10.10 with Intel GMA 4500) everything works fine with your code. I just modified the image name and I used a png that I already had on the computer.
精彩评论