This is the repository for example pygame code from The Nature of Code book. If you are looking for the book's raw content (text, illustrations, images, CSS, etc.), have a look at The Nature of Code repo.
The original Processing examples can be found here, along with a list of other ports.
To run the examples you have to have python and pygame-ce installed.
For some examples specific packages are needed. This is noted in the examples where you need them.
To install python and handle packages you can use the uv package manager.
Though uv you can install all dependencies of the examples.
uv sync
activate .venv/bin/activateThere are multiple ways to find the p5.js code for the examples for comparisson:
- Select the image of the example or the pink book icon underneath it to navigate to where the example appears in the book and select
Open in Web Editor. - Select the pink
p5.jslink under the given example from the examples page. - The examples can also be found in the content directory of the book's repository. However, please note that this directory is generated from the p5.js web editor and any example corrections should be filed as GitHub issues.