Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102269

How to resize an animated gif to fit the window

Newsgroups comp.lang.python
Date 2016-01-29 17:50 -0800
Message-ID <3216251b-bab1-4946-9d9a-17eb13e76726@googlegroups.com> (permalink)
Subject How to resize an animated gif to fit the window
From kwekey@gmail.com

Show all headers | View raw


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..

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to resize an animated gif to fit the window kwekey@gmail.com - 2016-01-29 17:50 -0800
  Re: How to resize an animated gif to fit the window Emile van Sebille <emile@fenx.com> - 2016-02-05 15:54 -0800

csiph-web