How to resize an animated gif to fit the window

Emile van Sebille emile at fenx.com
Fri Feb 5 18:54:45 EST 2016


Googling that finds 
https://cloud.google.com/appengine/docs/python/images/ which may be of 
some help.

Emile


On 1/29/2016 5:50 PM, kwekey at gmail.com wrote:
> 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