pygame: Python library for multimedia applications
Python wrapper for SDL enabling 2D game development.
Learn more about pygame
pygame is a Python library that wraps the Simple DirectMedia Layer (SDL) library along with other dependencies to provide abstractions for multimedia programming. It is implemented in a combination of C and Python, with native and OpenGL support for rendering. The library offers modules for 2D graphics, sprite management, collision detection, audio playback in multiple formats (WAV, MP3, OGG), and input handling from keyboards, mice, and joysticks. It is commonly used for developing 2D games, interactive applications, and educational projects in Python.
SDL-based abstraction
Built on top of SDL, pygame provides a higher-level Python interface to low-level multimedia functions while maintaining cross-platform compatibility across Windows, macOS, and Linux.
Integrated sprite and collision systems
Includes built-in sprite management and collision detection utilities specifically designed for game development, reducing boilerplate code for common game mechanics.
Multi-format audio support
Supports WAV, MP3, and OGG audio formats for both sound effects and background music, with functions for playback and manipulation.
import pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
player_pos = [400, 300]
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
player_pos[0] += 2
screen.fill((0, 0, 0))
pygame.draw.circle(screen, (255, 0, 0), player_pos, 25)
pygame.display.flip()
clock.tick(60)Bugfix release adding Python 3.13 support; pins Cython version range and removes PyPy 3.7.
- –Upgrade to Python 3.13 when available; Windows builds now include 3.13 support.
- –Pin Cython to a specific version range if building from source; old PyPy 3.7 support removed.
Maintenance release adding Python 3.12 support, bumping SDL to 2.28.4, and removing experimental Windows camera backend; no breaking changes documented.
- –Upgrade to SDL 2.28.4 for manylinux and Windows prebuilt dependencies to pick up upstream fixes.
- –Remove experimental camera_windows backend; verify camera functionality if you relied on Windows camera support.
Pre-release for testing only; release notes do not specify breaking changes, requirements, or new features.
- –Install with `python -m pip install pygame==2.6.0.dev2` for testing purposes only.
- –Consult https://github.com/pygame/pygame/issues for known issues; production use is not recommended.
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
redoc
React component rendering OpenAPI specifications as interactive HTML documentation.
crush
LLM-powered coding agent with LSP and MCP integration.
jsdom
Pure JavaScript implementation of web standards for Node.js.
statsd
UDP/TCP metrics collector with pluggable backend support.
bun
Fast JavaScript runtime with built-in bundler and package manager.