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)See how people are using Pygame
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
Axios
Promise-based HTTP client with unified browser and Node.js interface.
GraphiQL
Browser-based GraphQL IDE with language service tooling.
spdlog
Fast C++ logging with flexible sinks and fmt formatting.
VS Code LeetCode
VS Code extension for solving LeetCode problems directly in the editor with testing and submission.
WinGet
Multi-interface Windows package manager for Store and community repositories.