Getting Set Up for Pygame Turbo
Over the next several labs you'll build real video games: an alien dodging a
bee, tanks that hunt you down, weights falling from the sky, and an infinite
runner with costumes and a Game Over screen. Every game studio starts
somewhere. Ours starts with a folder named images.
Turbo? What happened to Zero?
Pygame Turbo is a newer, faster-moving version of the Pygame Zero library. Nearly everything works the same way, and it adds a few tools we'll use — most notably a built-in way to animate characters. If you run across Pygame Zero code online, it will look very familiar.
Overview
In this lab you'll install the Pygame Turbo library in Thonny, make a home folder for your games, download every image and animation the whole unit needs in one zip file, and run a tiny test program to prove your setup works. Ten minutes here saves a headache in every lab that follows.
Before you start
Open Thonny. If you can't find it on your computer, ask for help before continuing.
You've got it when…
-
pgturboshows as installed in Thonny's package manager. - You have a Pygame Turbo folder with folders named
imagesandanimationsinside it. - The
imagesfolder holds all 41 game images from the download, and theanimationsfolder holds four more folders of animation frames. - Your test program opens a window with the alien on a sky-blue background.
Collaboration & AI
Work: On your own. Ask a neighbor for a hand if you're stuck, but do the setup on your own computer.
AI — AIAS Level 1, No AI: This lab is about learning where your files live, and only you know where you put them. What the levels mean.
Install Pygame Turbo
Thonny comes with Python built in, but the Pygame Turbo library is a separate piece. Thonny has a package manager for exactly this job, so there's nothing to download from a website.
-
In Thonny, open the menu Tools ▸ Manage packages…
-
Type
pgturbointo the search box at the top and click Search on PyPI. -
Click pgturbo in the search results, then click Install. When the progress messages stop, click Close.
Warning
The package is named exactly pgturbo — no spaces, and no "pygame" in
front. Similarly named packages are not the library we want. In
particular, pgzero is the older library this one grew out of; it won't
run the programs in this unit.
Info
If pgturbo already appears in the list of installed packages when the window opens, someone has beaten you to it. Skip to the next section.
Make a Home for Your Games
Every game you write in this unit will live in one folder, next to a shared
images folder and a shared animations folder. Keeping them together is
not just tidiness — Pygame Turbo only looks for images in a folder named
images sitting beside your program, and for animations in a folder named
animations in the same place.
- In your Documents folder (or wherever your teacher tells you), create a
new folder named
pygame-turbo.
Download the Game Images
Your games will star an alien, a bee, two tanks, some hearts, and a small wardrobe of runner costumes. All 41 images, plus the animation frames for the bee and the three costumes, are in one zip file.
-
Download the zip file.
-
Double-click the downloaded file to unpack it. On Windows, right-click it and choose Extract All… instead. Either way, you end up with two folders,
imagesandanimations. -
Move both folders into your
pygame-turbofolder.
Warning
The folders must be named exactly images and animations — all
lowercase, no spaces — and they must sit inside your pygame-turbo
folder, next to the programs you'll write. Pygame Turbo will not look
anywhere else.
What's in the zip?
All 41 images for the whole unit, so you only do this download once. Each
lab also offers its own images as individual downloads, in case one ever
goes missing. The animations folder holds four folders — bee, ninja,
dino, and knight — each a numbered series of pictures that Pygame
Turbo can play like a flip book. You'll meet them in labs 30 and 100.
Test Your Setup
The smallest possible game will tell us whether everything is in the right place.
-
In Thonny, create a new program and save it as
alien_test.pyin yourpygame-turbofolder — next to theimagesfolder, not inside it. -
Type this program.
-
Run your program with the Run button (or press F5). Your screen should look like this.

The bookends
Two lines in that program do jobs our old editor used to do for us.
import pgtrun is the first line of every game — it loads the Pygame
Turbo library. pgtrun.go() is the last line — it starts the game
running. Everything between the bookends is your game. Every program in
this unit begins and ends exactly this way.
Where did the alien come from?
Actor("alien") found alien.png in your images folder by name — no
.png needed. That's the whole reason the folder matters.
Checkpoint
If the alien is on your screen, your setup is done and every lab in this
unit will find its images and animations. If you got an error instead, check that
alien_test.py sits next to (not inside) the images folder, and that
the folder name is exactly images. An error like
No module named 'pgtrun' means the library isn't installed — go back to
Install Pygame Turbo at the top of this lab.
Turn It In
- Submit your
alien_test.pyfile in Google Classroom.
How It's Graded
This lab is worth up to 4 points. One score covers everything you turn in.
| Score | What it looks like |
|---|---|
| 4 — Excellent | Your alien_test.py runs as-is: a window opens with the alien centered on sky blue. That only happens when everything upstream is right — pgturbo installed, all 41 images inside a folder named exactly images with the animations folder beside it, and your program saved next to those folders, not inside them. |
| 3 — Above Average | The setup works with a minor slip you had to fix along the way — the file saved in the wrong spot and moved, or a mistyped folder name corrected at the checkpoint. |
| 2 — Average | pgturbo is installed and the folders exist, but the test program errors or was never finished — or the animations folder never made it out of the zip. |
| 1 — Below Average | Little of the setup done — no images folder in place, or no test program at all. |
| 0 — Failing | Nothing submitted, or no evidence of the setup. |