Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102269 > unrolled thread
| Started by | kwekey@gmail.com |
|---|---|
| First post | 2016-01-29 17:50 -0800 |
| Last post | 2016-02-05 15:54 -0800 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | kwekey@gmail.com |
|---|---|
| Date | 2016-01-29 17:50 -0800 |
| Subject | How to resize an animated gif to fit the window |
| Message-ID | <3216251b-bab1-4946-9d9a-17eb13e76726@googlegroups.com> |
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..
[toc] | [next] | [standalone]
| From | Emile van Sebille <emile@fenx.com> |
|---|---|
| Date | 2016-02-05 15:54 -0800 |
| Message-ID | <mailman.27.1454716518.2317.python-list@python.org> |
| In reply to | #102269 |
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@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..
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web