pyglet is a cross-platform windowing and multimedia library for Python. pyglet main features are:
- No external dependencies or installation requirements. For most application and game requirements, pyglet needs nothing else besides Python, simplifying distribution and installation.
- Take advantage of multiple windows and multi-monitor desktops. pyglet allows you to use as many windows as you need, and is fully aware of multi-monitor setups for use with fullscreen games.
- Load images, sound, music and video in almost any format. pyglet can optionally use AVbin to play back audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as DivX, MPEG-2, H.264, WMV and Xvid.
pyglet provides also an OpenGL support via the pyglet.gl package but from the doc, pyglet.gl is less pythonic than PyOpenGL.
I’ll test this cool Python lib with GeeXLab as soon as possible (I will update GeeXLab shortly).
Here a short code snippet:
from pyglet import image from pyglet.gl import * img = image.load('image.jpg') width, height = img.width, img.height GL_texture = img.get_texture() glEnable(GL_texture.target) # typically target is GL_TEXTURE_2D glBindTexture(GL_texture.target, GL_texture.id) rawimage = image.get_image_data() format = 'RGBA' pitch = rawimage.width * len(format) pixels = rawimage.get_data(format, pitch)