How to resize an animated gif to fit the window
kwekey at gmail.com
kwekey at gmail.com
Fri Jan 29 20:50:29 EST 2016
Hi, I am able to display animated gif using pyglet using below code, but I would like the image to stretch and fit the window as i resize the window.
Any one can help me?
import pyglet
# pick an animated gif file you have in the working directory
CODE: SELECT ALL
def animate(str):
ag_file = str
animation = pyglet.resource.animation(ag_file)
sprite = pyglet.sprite.Sprite(animation)
# create a window and set it to the image size
win = pyglet.window.Window(width=sprite.width, height=sprite.height)
@win.event
def on_draw():
win.clear()
sprite.draw()
pyglet.app.run()
animate("***.gif")
CODE: SELECT ALL
win = pyglet.window.Window(width=sprite.width, height=sprite.height)
Above line will resize the window to fit the animated gif but i want it the other way, that is the gif to fit the windows size..
More information about the Python-list
mailing list