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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.