This project provides a small Processing-like API on top of Pygame, using Python-style naming. It is designed for quick visual programming, classroom demos, and beginner-friendly sketch workflows.
The goal is to let you write simple sketches with minimal setup:
- define
setup()for one-time initialization - define
draw()for frame-by-frame rendering - call
run()to start the sketch loop
You can use functions like size(), background(), circle(), text(), image(), and input callbacks.
- Have Python!
- Install Pygame using pip: pip install pygame
Create a file like my_sketch.py:
from processing import *
x = 0
def setup():
size(800, 500)
frame_rate(60)
title("My First Sketch")
def draw():
global x
background(245)
fill(80, 170, 255)
no_stroke()
circle(x, 250, 40)
x = (x + 2) % width
run()Run it with:
python my_sketch.pySee api.md for the full English API reference, including:
- public constants
- public runtime variables
- public functions
- optional callback handlers
- Function and variable names follow
snake_case. - ESC closes the sketch window.
- The runtime supports both static and interactive sketch modes.