Skip to main content
2025 Python Packaging Survey is now live!  Take the survey now

A zero-boilerplate 2D games framework

Project description

A zero-boilerplate games programming framework based on Pygame.

Some examples

Pygame Zero consists of a runner pgzrun that will run a Pygame Zero script with a full game loop and a range of useful builtins.

Here’s some of the neat stuff you can do (each one of these would be a self-contained, runnable script):

Draw graphics (from the images/ directory):

def draw():
    screen.clear()
    screen.blit(images.dog, (10, 50))

Play a sound (from the sounds/ directory) when you click the mouse:

def on_mouse_down():
    sounds.eep.play()

Update and draw an “actor” object:

alien = Actor('alien')
alien.pos = 10, 10

def draw():
    screen.clear()
    alien.draw()

def update():
    alien.x += 1
    if alien.left > WIDTH:
        alien.right = 0

Installation

  1. Install Pygame for Python 3

  2. Install Pygame Zero (python setup.py install)

  3. “python3 -m pgzero <pgzero program>” or (if installed correctly) pgzrun <program>

Documentation

The full documentation is at http://pygame-zero.readthedocs.org/.

Read the tutorial at http://pygame-zero.readthedocs.org/en/latest/introduction.html for a taste of the other things that Pygame Zero can do.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page