TUTORIALS Fortune teller
PYTHON
Build your own fortune teller
Mystic Les Pounder predicts that you will learn lots of Python and Pygame knowledge in this tutorial.
OUR EXPERT
Les Pounder is associate editor at Tom’s Hardware and a freelance maker for hire. He blogs about his adventures and projects at
http://bigl.es.
YOU NEED
A Pi 3,4 or 5
All of the code examples, images and audio can be found in the GitHub download package at https:// github. com/lesp/LXF317Fortune-Teller/archive/refs/heads/main. zip
One of my earliest commissioned projects was for a coin-operated fortune teller, which lives in an arcade in Blackpool. I wanted to make a modern version, so I dug out a Raspberry Pi 4 and dusted off my old Pygame knowledge. We are making a fortune teller video game in 55 lines of Python.
Prepare thy Pi
First, we need to set up our environment. Raspberry Pi OS Bookworm follows PEP668, which forces us to set up virtual environments (virtualenv) to install Python packages. This is so our manually installed packages do not conflict with the Python setup for the OS.