pyglet Documentation
Attention
This documentation is for the pyglet 2.x series, which has incompatible changes from the 1.5 and older releases. If you are looking for documentation for the previous stable release, please see 1.5 maintenance.
pyglet is a cross-platform windowing and multimedia library for Python, intended for developing games and other visually rich applications. It supports windowing, user interface event handling, game controllers and joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. pyglet works on Windows, OS X and Linux.
Some of the 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.
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 and applications.
Load images, sound, music and video in almost any format. pyglet has built-in support for common audio and image formats, and can optionally use ffmpeg to load almost any other compressed audio or video files.
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.
Please join our Discord server, or join us on the mailing list!
If this is your first time reading about pyglet, we suggest you start at Writing a pyglet application. If you are migrating from an older version of pyglet, please read through Migrating from pyglet 1.5.
Programming Guide
- Installation
- Writing a pyglet application
- Windowing
- Keyboard input
- Mouse input
- Controller & Joystick input
- Drawing Shapes
- Images and Sprites
- Playing Sound and Video
- Displaying text
- Application resources
- Shaders and Rendering
- Dispatching Events
- Keeping track of time
- Creating an OpenGL context
- The OpenGL interface
- Matrix and Vector Math
- The application event loop
- In-depth game example
- Runtime Options
- Debugging tools
- Migrating from pyglet 1.5
API Reference
- pyglet
- pyglet.app
- pyglet.canvas
- pyglet.clock
- pyglet.event
- pyglet.font
- pyglet.gl
- pyglet.graphics
- pyglet.gui
- pyglet.image
- pyglet.info
- pyglet.input
- pyglet.math
- pyglet.media
- pyglet.resource
- pyglet.sprite
- pyglet.shapes
Arc
BezierCurve
BezierCurve.group_class
BezierCurve.delete()
BezierCurve.draw()
BezierCurve.anchor_position
BezierCurve.anchor_x
BezierCurve.anchor_y
BezierCurve.batch
BezierCurve.color
BezierCurve.group
BezierCurve.opacity
BezierCurve.points
BezierCurve.position
BezierCurve.t
BezierCurve.visible
BezierCurve.x
BezierCurve.y
BorderedRectangle
BorderedRectangle.group_class
BorderedRectangle.delete()
BorderedRectangle.draw()
BorderedRectangle.anchor_position
BorderedRectangle.anchor_x
BorderedRectangle.anchor_y
BorderedRectangle.batch
BorderedRectangle.border_color
BorderedRectangle.color
BorderedRectangle.group
BorderedRectangle.height
BorderedRectangle.opacity
BorderedRectangle.position
BorderedRectangle.rotation
BorderedRectangle.visible
BorderedRectangle.width
BorderedRectangle.x
BorderedRectangle.y
Circle
Ellipse
Line
Polygon
Rectangle
Rectangle.group_class
Rectangle.delete()
Rectangle.draw()
Rectangle.anchor_position
Rectangle.anchor_x
Rectangle.anchor_y
Rectangle.batch
Rectangle.color
Rectangle.group
Rectangle.height
Rectangle.opacity
Rectangle.position
Rectangle.rotation
Rectangle.visible
Rectangle.width
Rectangle.x
Rectangle.y
Sector
Star
Triangle
- pyglet.text
- pyglet.text.caret
- pyglet.text.document
- pyglet.text.layout
- Style attributes
IncrementalTextDecorationGroup
IncrementalTextLayout
IncrementalTextLayoutGroup
ScrollableTextDecorationGroup
ScrollableTextLayout
ScrollableTextLayoutGroup
TextDecorationGroup
TextLayout
TextLayoutGroup
get_default_decoration_shader()
get_default_image_layout_shader()
get_default_layout_shader()
DocumentDecodeException
DocumentDecoder
DocumentLabel
HTMLLabel
Label
decode_attributed()
decode_html()
decode_text()
get_decoder()
load()
- pyglet.window
External Resources
Development Guide
- Contributing
- Development environment
- Testing pyglet
- Documentation
- Making a pyglet release
- OpenGL Interface Implementation
- ctypes Wrapper Generation
- wraptypes
- Media manual
- Media logging manual