{"schemaVersion":"1.0","record":{"label":"pyglet","description":"Python windowing and multimedia library with event-driven input and OpenGL rendering.","aliases":[],"kind":"software","website":"https://pyglet.org/","overview":"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.","license":"BSD-3-Clause for pyglet; optional media libraries and other dependencies retain separate terms.","lifecycle":"active","example":false,"features":[{"name":"Window event loop","status":"supported","detail":"The application loop dispatches operating-system events, scheduled callbacks and drawing rather than requiring every program to implement that loop manually.","useCase":"Developing event-driven Python desktop games and multimedia applications","platforms":["Windows","macOS","Linux"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://pyglet.readthedocs.io/en/latest/modules/app.html","locator":"Event loop, scheduled updates and drawing intervals","retrievedAt":"2026-10-07T20:04:16Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html","locator":"2.1 event loop, on_draw and resource loading","retrievedAt":"2026-10-07T20:02:33Z","kind":"vendor"}]},{"name":"Batched OpenGL drawing","status":"supported","detail":"Batch and Group organize related drawables and rendering state; vertex resources have explicit update/deletion considerations.","useCase":"Developing event-driven Python desktop games and multimedia applications","platforms":["Windows","macOS","Linux"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/rendering.html","locator":"Batch/Group rendering and vertex resource lifetime","retrievedAt":"2026-10-07T20:04:04Z","kind":"vendor"}]},{"name":"Media playback","status":"limited","detail":"Codec availability depends on platform libraries or optional decoders; the documented video route requires FFmpeg.","useCase":"Developing event-driven Python desktop games and multimedia applications","platforms":["Windows","macOS","Linux"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/media.html","locator":"Platform codecs, FFmpeg video and streaming/static sources","retrievedAt":"2026-10-07T20:03:51Z","kind":"vendor"}]},{"name":"Headless graphics","status":"limited","detail":"Headless mode requires graphics drivers with EGL support and omits visible windows.","useCase":"Developing event-driven Python desktop games and multimedia applications","platforms":["Windows","macOS","Linux"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/options.html","locator":"DPI, EGL headless mode and platform behavior","retrievedAt":"2026-10-07T20:04:16Z","kind":"vendor"}]}],"alternatives":[],"slug":"pyglet","draftAlternatives":[{"targetSlug":"pygame","status":"limited","detail":"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.","useCase":"Developing event-driven Python desktop games and multimedia applications","platforms":["Windows","macOS","Linux"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html","locator":"2.1 event loop, on_draw and resource loading","retrievedAt":"2026-10-07T20:02:33Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/rendering.html","locator":"Batch/Group rendering and vertex resource lifetime","retrievedAt":"2026-10-07T20:04:04Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/media.html","locator":"Platform codecs, FFmpeg video and streaming/static sources","retrievedAt":"2026-10-07T20:03:51Z","kind":"vendor"},{"url":"https://www.pygame.org/docs/","locator":"Explicit game loop and multimedia scope","retrievedAt":"2026-10-07T19:53:52Z","kind":"vendor"}]}],"evidence":[{"url":"https://pyglet.org/","locator":"Desktop platforms, windowing, input and Python implementation","retrievedAt":"2026-10-07T19:59:12Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html","locator":"2.1 event loop, on_draw and resource loading","retrievedAt":"2026-10-07T20:02:33Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/modules/app.html","locator":"Event loop, scheduled updates and drawing intervals","retrievedAt":"2026-10-07T20:04:16Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/rendering.html","locator":"Batch/Group rendering and vertex resource lifetime","retrievedAt":"2026-10-07T20:04:04Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/media.html","locator":"Platform codecs, FFmpeg video and streaming/static sources","retrievedAt":"2026-10-07T20:03:51Z","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/options.html","locator":"DPI, EGL headless mode and platform behavior","retrievedAt":"2026-10-07T20:04:16Z","kind":"vendor"},{"url":"https://github.com/pyglet/pyglet/blob/master/LICENSE","locator":"BSD three-clause redistribution conditions","retrievedAt":"2026-10-07T20:03:51Z","kind":"vendor"},{"url":"https://www.pygame.org/docs/","locator":"Explicit game loop and multimedia scope","retrievedAt":"2026-10-07T19:53:52Z","kind":"vendor"}],"document":{"version":1,"references":[{"url":"https://pyglet.org/","locator":"Desktop platforms, windowing, input and Python implementation","retrievedAt":"2026-10-07T19:59:12Z","id":"home","title":"pyglet overview","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/quickstart.html","locator":"2.1 event loop, on_draw and resource loading","retrievedAt":"2026-10-07T20:02:33Z","id":"quick","title":"Writing a pyglet application","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/modules/app.html","locator":"Event loop, scheduled updates and drawing intervals","retrievedAt":"2026-10-07T20:04:16Z","id":"app","title":"pyglet application API","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/rendering.html","locator":"Batch/Group rendering and vertex resource lifetime","retrievedAt":"2026-10-07T20:04:04Z","id":"render","title":"pyglet shaders and rendering","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/media.html","locator":"Platform codecs, FFmpeg video and streaming/static sources","retrievedAt":"2026-10-07T20:03:51Z","id":"media","title":"pyglet sound and video","kind":"vendor"},{"url":"https://pyglet.readthedocs.io/en/latest/programming_guide/options.html","locator":"DPI, EGL headless mode and platform behavior","retrievedAt":"2026-10-07T20:04:16Z","id":"options","title":"pyglet runtime options","kind":"vendor"},{"url":"https://github.com/pyglet/pyglet/blob/master/LICENSE","locator":"BSD three-clause redistribution conditions","retrievedAt":"2026-10-07T20:03:51Z","id":"license","title":"pyglet license","kind":"vendor"},{"url":"https://www.pygame.org/docs/","locator":"Explicit game loop and multimedia scope","retrievedAt":"2026-10-07T19:53:52Z","id":"pygame","title":"pygame quick start","kind":"vendor"}],"overviewCitations":["home","quick"],"licenseCitations":["license","media"],"sections":[{"id":"loop","heading":"Events and timing","paragraphs":[{"id":"loop-detail","content":[{"text":"A typical pyglet application creates a window and attaches handlers for drawing and input, then enters the library's application loop. That loop also services scheduled functions. Developers can customize drawing intervals and integrate more specialized behavior, but the normal workflow delegates platform event processing to pyglet. This differs from libraries whose introductory workflow has the application explicitly poll and present every frame."}],"citations":["quick","app"]}]},{"id":"rendering","heading":"Rendering organization","paragraphs":[{"id":"rendering-detail","content":[{"text":"Batch groups compatible vertex data and drawables so the renderer can submit related work together. Group objects associate rendering state and ordering with those objects. These abstractions are useful for sprites, labels and custom drawing, while direct OpenGL access remains available. References to editable vertex lists also matter for updating or explicitly deleting their GPU data, so scene removal and resource lifetime should be planned together."}],"citations":["render","home"]}]},{"id":"resources","heading":"Loading application content","paragraphs":[{"id":"resources-detail","content":[{"text":"The quick-start guide distinguishes loading an application resource from loading an arbitrary user-selected image file. Resource loading locates content relative to the application rather than simply assuming the current working directory. This matters when launching a packaged program from a desktop shortcut or a different directory. Image loading provides graphics content, not conversion of another engine's scene objects or gameplay state."}],"citations":["quick"]}]},{"id":"media","heading":"Media dependencies","paragraphs":[{"id":"media-detail","content":[{"text":"The 2.1 media guide describes built-in WAV support and additional formats supplied by platform codecs or optional libraries. Video playback uses FFmpeg and exposes frames as OpenGL textures. Applications can stream media or decode reusable sound effects into memory. Supported formats therefore depend on the deployment's decoder stack, and shipping a Python program alone does not establish that every target machine can play its chosen video files."}],"citations":["media"]}]},{"id":"platforms","heading":"Platform behavior","paragraphs":[{"id":"platforms-detail","content":[{"text":"pyglet targets Windows, macOS and Linux and exposes options for differences such as high-DPI sizing. A logical window size and its pixel framebuffer size can differ, so interface layout and input coordinates may require attention. Headless mode is documented for systems with EGL-capable graphics drivers. This article uses the 2.1 documentation and does not infer stable browser deployment from separate development-branch work."}],"citations":["home","options"]}]},{"id":"licensing","heading":"Licensing","paragraphs":[{"id":"licensing-detail","content":[{"text":"pyglet uses the BSD three-clause license, permitting redistribution with notice and non-endorsement conditions. Optional media components have their own terms; the media documentation specifically discusses different FFmpeg build licenses. A project's dependency choices and bundled binaries therefore remain relevant even though pyglet's own license is permissive."}],"citations":["license","media"]}]},{"id":"comparison","heading":"Substitution considerations","paragraphs":[{"id":"comparison-detail","content":[{"text":"pyglet can replace parts of a "},{"text":"pygame","targetSlug":"pygame"},{"text":" desktop game or multimedia workflow when the project benefits from event-driven windows and OpenGL rendering. The change involves adapting the loop, image representation, drawing and playback APIs rather than renaming imports. It is most useful as a choice of application foundation, with the actual asset formats and target systems checked separately."}],"citations":["quick","app","render","media","pygame"]}]}]},"id":"Q640","revision":688,"updatedAt":"2026-10-13T00:52:31Z","sourceUrl":"https://substitutefor.net/entities/Q640?revision=688"}}