Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pypi rtd PyTest

logo_large.png

pyglet

pyglet is a cross-platform windowing and multimedia library for Python, intended for developing games and other visually rich applications. It supports Windowing, input event handling, Controllers & Joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. pyglet works on Windows, OS X and Linux.

❗ ❗ We are preparing to release a major pyglet update very soon. Version 3.0 will include an extensive internal rewrite, bringing support for multiple rendering backends and significant performance improvements. This brings back support for some legacy platforms, as well as new support for WebGL. The high level APIs will be largely the same, but some adjustments will be necessary if you are using OpenGL directly in your game or application. See the migration guide to prepare for the new release at https://pyglet.readthedocs.io/en/development/programming_guide/migration.html, and try out the new release by downloading a 3.0.devX release today (pip install --upgrade pyglet --pre). If you want to do a pull request for the previous release, please target the appropriate branch.

pyglet has an active developer and user community. If you find a bug or a problem with the documentation, please open an issue. Anyone is welcome to join our discord server where a lot of the development discussion is going on. It's also a great place to ask for help.

Some features of pyglet are:

  • No external dependencies or installation requirements. For most application and game requirements, pyglet needs nothing else besides Python, simplifying distribution and installation. It's easy to package and distribute your project with Nuitka or PyInstaller.
  • Take advantage of multiple windows and multi-monitor desktops. pyglet allows you to use multiple platform-native windows, 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 FFmpeg to play back audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as MPEG2, H.264, H.265, WMV and Xvid. Without FFmpeg, pyglet contains built-in support for standard formats such as wav, png, bmp, and others.
  • pyglet is written entirely in pure Python, and makes use of the ctypes module to interface with system libraries. You can modify the codebase or make a contribution without any second language compilation steps or compiler setup. Despite being pure Python, pyglet has excellent performance thanks to advanced batching for drawing thousands of objects.
  • pyglet is provided under the BSD open-source license, allowing you to use it for both commercial and other open-source projects with very little restriction.

Requirements

pyglet runs under Python 3.10+. Being written in pure Python, it also works on other Python interpreters such as PyPy. Supported platforms are:

  • Windows 7 or later
  • macOS 10.9 or later.
  • Linux, with the following libraries (most recent distributions will have these in a default installation):
    • OpenGL and GLX
    • GDK 2.0+ or Pillow (required for loading images other than PNG and BMP)
    • OpenAL or Pulseaudio (required for playing audio)

As of pyglet 2.0, OpenGL 3.3+ is required.

To play a large variety of compressed audio and video files, pyglet can optionally take advantage of FFmpeg.

Installation

pyglet is installable from PyPI:

pip install --upgrade --user pyglet

Installation from source

If you're reading this README from a source distribution, you can install pyglet with:

pip install --upgrade --user .
# or
python setup.py install --user

You can also install the latest development version directly from Github:

pip install --upgrade --user https://github.com/pyglet/pyglet/archive/master.zip

For local development install pyglet in editable mode:

# with pip
pip install -e .
# with setup.py
python setup.py develop

There are no compilation steps during the installation; if you prefer, you can simply add this directory to your PYTHONPATH and use pyglet without installing it. You can also copy pyglet directly into your project folder.

Contributing

A good way to start contributing to a component of pyglet is by its documentation. When studying the code you are going to work with, also read the associated docs. If you don't understand the code with the help of the docs, it is a sign that the docs should be improved. If you wish to make large changes to any part of pyglet, it's always a good idea to reach out for feedback first. This can avoid wasted effort in cases where someone is already working on something similar, or if your idea can't be accepted for any reason.

A basic outline of how to a contribution is as follows:

  • Fork the official repository.
  • In your fork, checkout the branch you wish to contribute to (such as pyglet-1.5-maintenance).
  • Apply your changes to your fork.
  • Submit a pull request describing the changes you have made.
  • Alternatively you can create a patch and submit it to the issue tracker.

When making a pull request, check that you have addressed its respective documentation, both within the code docstrings and the programming guide (if applicable). It is very important to all of us that the documentation matches the latest code and vice versa.

Consequently, an error in the documentation, either because it is hard to understand or because it doesn't match the code, is a bug that deserves to be reported on a ticket.

Building Docs

To get started quickly:

python -m pip install -e . --group docs
python make.py docs

Please check Documentation and Type Hints guide to learn more.

Testing

pyglet makes use of pytest for its test suite.

python -m pip install -e . --group test
# Only run unittests
pytest tests/unit

Please check the testing section in the development guide for more information about running and writing tests.

Contact

pyglet is developed by many individual volunteers, and there is no central point of contact. If you have a question about developing with pyglet, or you wish to contribute, please join the discord server, or subreddit.

For legal issues, please contact Alex Holkner.

Release files for pyglet 3.0.dev11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyglet 3.0.dev11
File Size Uploaded
pyglet-3.0.dev11.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyglet 3.0.dev11
File Interpreter ABI Platform
pyglet-3.0.dev11-py3-none-any.whl Python 3 none any Details

Total release size: 3.2 MB

Release files / pyglet-3.0.dev11.tar.gz

Download URL pyglet-3.0.dev11.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
e8bb6d4e5f1eb34da4fba30d2786b9c823e84f780db8ef76b60ffc975e51ef00
BLAKE2b-256 checksum
How to use checksums
4d7b4a2a710751730fd5b9a26af610436e3eab8d767252e37c77e721b1b48e91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyglet-3.0.dev11-py3-none-any.whl

Download URL pyglet-3.0.dev11-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
13f0bd3b286bf33ed5aa4de6df687512e136676080b5f991b01ead5c37df0432
BLAKE2b-256 checksum
How to use checksums
7d1b9a654be062972d403c0c1aaaa5d26a84f2ff8e823b497852398bfffeedbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

3.0.dev11 This release

2 release files

2.1.15

2 release files

2.1.9

2 release files

2.1.8

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.21

2 release files

2.0.16

2 release files

2.0.12

2 release files

2.0.11

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.31

2 release files

1.5.30

2 release files

1.5.29

2 release files

1.5.28

2 release files

1.5.27

2 release files

1.5.26

2 release files

1.5.24

2 release files

1.5.23

2 release files

1.5.21

2 release files

1.5.19

2 release files

1.5.18

2 release files

1.5.17

2 release files

1.5.16

2 release files

1.5.14

2 release files

1.5.13

2 release files

1.5.11

2 release files

1.5.10

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.11

2 release files

1.4.10

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

4 release files

1.2.3

4 release files

1.2.2

4 release files

1.2.1

4 release files

1.2.0

4 release files

1.1.4

1 release file

1.1.2

1.1.1

1.1

1.0

1.0beta3

1.0beta2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page