•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 363,779 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,496 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:
The module pyglet leans on OpenGL for graphics and is used in the scientific community together with Python. This short code snippet shows you how to use it to display an animated GIF file. The download is free, so give it a try. You don't have to download OpenGL to use pyglet.
# load and show an animated gif file using module pyglet # download module pyglet from: http://www.pyglet.org/download.html # the animated dinosaur-07.gif file is in the public domain # download from http://www.gifanimations.com # tested with Python2.5 and pyglet1.1a2 by vegaseat 22apr2008 import pyglet # pick an animated gif file you have in the working directory ag_file = "dinosaur-07.gif" 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) # set window background color = r, g, b, alpha # each value goes from 0.0 to 1.0 green = 0, 1, 0, 1 pyglet.gl.glClearColor(*green) @win.event def on_draw(): win.clear() sprite.draw() pyglet.app.run()
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)