GUIs & Games

pyglet

A lean, no-nonsense engine for building games and multimedia apps that don't need a giant toolkit.

Install it: pip install pyglet

What does it do?

Pyglet handles windows, graphics, sound, and input for games and multimedia applications, similar territory to Pygame, but with a design that leans on more modern graphics techniques and requires no external dependencies to install, it works right out of the box. It’s a lightweight, self-contained workshop: everything you need is already in the box, nothing extra to download or configure first. It’s been used for everything from simple 2D games to visualizations and even scientific demos that need smooth, responsive graphics. Unlike some alternatives, it doesn’t wrap an existing library like SDL; it talks more directly to the operating system’s graphics and audio systems.

See it in action

This opens a window and displays a line of text centered on the screen.

import pyglet

window = pyglet.window.Window()
label = pyglet.text.Label("Hello, pyglet!", x=window.width // 2, y=window.height // 2, anchor_x="center")

@window.event
def on_draw():
    window.clear()
    label.draw()

pyglet.app.run()

Why would a non-developer care?

For developers who value simplicity and hate wrestling with installation problems, a library that just works after a single pip install removes an entire category of early frustration. It matters to anyone who’s lost an afternoon to dependency errors before writing a single line of actual game logic.

Real-world examples

Pyglet has been used as the rendering engine underneath other Python tools, including certain scientific visualization projects that needed smooth animated graphics. It’s popular among developers building small multimedia experiments, simple games, and custom visualization tools who want more control than a high-level library offers without the installation overhead of larger engines.

Who uses it

Developers building lightweight 2D games, multimedia demos, and custom visualizations who want minimal setup friction.

How it compares to alternatives

Pyglet is more self-contained than Pygame since it avoids depending on external libraries like SDL, but Pygame has a larger community and more tutorials, and compared to full engines like Godot, pyglet offers far less out of the box but much finer low-level control.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries