Python

Lessons → Python Book
Python Book · Chapter 1

Getting Python & Pygame Ready

Before we build drifting stars, bouncing colors, and the Chaos Equalizer, we need a playground. This chapter gets Python and Pygame installed, tested, and ready so every future project is just “save and run.”

Chapter 1 of 6

Same loop. New playground.

The Play-First Loop doesn’t change just because we switched languages. You’ll still Imagine, Prompt, Play, and Tweak & Break — only now your toys live in a Python window instead of a browser.

Python gives you motion, physics, sound, and full-screen windows. It’s the next step up from HTML — more power, same philosophy.


Everything you need. All free.

For Python, we add one extra ingredient compared to HTML: an interpreter that can run code, and a small game library that draws shapes and motion on the screen.

🐍
Python 3
The engine that runs all your code. Once it’s installed, every .py file becomes a little executable toy.
Windows Download Python 3 from python.org. When the installer opens, check Add Python to PATH before clicking Install.
Mac Install Python 3 from python.org or use Homebrew:
brew install python
🎮
Pygame
A tiny game library that opens a window, draws shapes, and lets you animate stars, balls, and chaos sliders.
Install via pip
pip install pygame
📝
A code editor
Where you’ll paste and tweak the Python scripts your AI builds for you.
Simple Use IDLE, which comes with Python.
Advanced Use VS Code for a smoother workflow.

Prove Python & Pygame are alive.

Just like the HTML sandbox.html file, this first script is a smoke test. We’re not using AI yet — we’re just making sure your environment works.

1
Open your editor

Create a new file called sandbox.py.

2
Type this code
import pygame
pygame.init()

screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption(“My Python Vibe Clubhouse”)

running = True
while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False

  screen.fill((10, 10, 30))
  pygame.display.flip()

pygame.quit()
3
Run the file

A window titled “My Python Vibe Clubhouse” should appear.

4
Close the window

If it closes cleanly — your setup is ready.

✅
If you see the window and can close it — you’re set up.

Your Python sandbox is officially alive and ready for stars, trails, and chaos.


The rules of the clubhouse.
🌱
Curiosity is the only qualification
You don’t need to understand every line of Python yet. If you can ask “what happens if I change this number?” — you belong here.
💥
We break windows on purpose
If your Pygame window crashes or freezes, that’s not failure — it’s a landmark.
🎮
If you enjoyed making it, it worked
We’re building toys that teach you how motion, events, and state feel in your hands.
You’re in Python Book · Chapter 1 of 6
Play-First Programming · playfirstprogramming.com A clubhouse for curious builders