# pyglet

Python windowing and multimedia library with event\-driven input and OpenGL rendering\.

ID: Q640 · Revision: 688

Type: software · License: BSD\-3\-Clause for pyglet; optional media libraries and other dependencies retain separate terms\.[^license][^media] · Status: active

Website: https://pyglet.org/



pyglet is a Python library for windowing, input, graphics and media playback on desktop systems\. It combines an event\-driven application loop with OpenGL access and higher\-level objects such as sprites and text\. It can form the foundation of a custom game or visualization application, while leaving game\-specific architecture to the developer\.[^home][^quick]

## Capabilities and substitutions

### Window event loop — supported

The application loop dispatches operating\-system events, scheduled callbacks and drawing rather than requiring every program to implement that loop manually\.[^quick][^app]

Use case: Developing event\-driven Python desktop games and multimedia applications · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### Batched OpenGL drawing — supported

Batch and Group organize related drawables and rendering state; vertex resources have explicit update/deletion considerations\.[^render]

Use case: Developing event\-driven Python desktop games and multimedia applications · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### Media playback — limited

Codec availability depends on platform libraries or optional decoders; the documented video route requires FFmpeg\.[^media]

Use case: Developing event\-driven Python desktop games and multimedia applications · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### Headless graphics — limited

Headless mode requires graphics drivers with EGL support and omits visible windows\.[^options]

Use case: Developing event\-driven Python desktop games and multimedia applications · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

### [Substitute for pygame](/pygame) — limited

Assessment: an alternative for Python desktop games and multimedia programs when event\-driven windows and OpenGL\-based drawing fit\. pygame Surface operations, loop structure and audio APIs need adaptation; this is not source\-compatible substitution or a guarantee of mobile/browser parity\.[^quick][^render][^media][^pygame]

Use case: Developing event\-driven Python desktop games and multimedia applications · Platforms: Windows, macOS, Linux · Region: Version, build and integration requirements apply

## References

[^home]: [pyglet overview](<https://pyglet.org/>) — Desktop platforms, windowing, input and Python implementation (vendor; retrieved 2026-10-07T19:59:12Z)

[^quick]: [Writing a pyglet application](<https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html>) — 2\.1 event loop, on\_draw and resource loading (vendor; retrieved 2026-10-07T20:02:33Z)

[^app]: [pyglet application API](<https://pyglet.readthedocs.io/en/latest/modules/app.html>) — Event loop, scheduled updates and drawing intervals (vendor; retrieved 2026-10-07T20:04:16Z)

[^render]: [pyglet shaders and rendering](<https://pyglet.readthedocs.io/en/latest/programming_guide/rendering.html>) — Batch/Group rendering and vertex resource lifetime (vendor; retrieved 2026-10-07T20:04:04Z)

[^media]: [pyglet sound and video](<https://pyglet.readthedocs.io/en/latest/programming_guide/media.html>) — Platform codecs, FFmpeg video and streaming/static sources (vendor; retrieved 2026-10-07T20:03:51Z)

[^options]: [pyglet runtime options](<https://pyglet.readthedocs.io/en/latest/programming_guide/options.html>) — DPI, EGL headless mode and platform behavior (vendor; retrieved 2026-10-07T20:04:16Z)

[^license]: [pyglet license](<https://github.com/pyglet/pyglet/blob/master/LICENSE>) — BSD three\-clause redistribution conditions (vendor; retrieved 2026-10-07T20:03:51Z)

[^pygame]: [pygame quick start](<https://www.pygame.org/docs/>) — Explicit game loop and multimedia scope (vendor; retrieved 2026-10-07T19:53:52Z)

Source revision: https://substitutefor.net/entities/Q640?revision=688
