For the later adventures in the book you will need to install PyGame in order to run the programs. Instructions for installing PyGame are given here; just find the section for the operating system you are using and follow the steps.
Windows 8
If you are using Windows 8, follow these steps to install PyGame:
Open a web browser (such as Internet Explorer, Chrome or Firefox).
In the address bar, type pygame.org/download.shtml and press the Enter key.
When the page loads, scroll down to the Windows section.
Click on the pygame-1.9.1.win32-py2.7.msi link to begin downloading the file (see Figure A-1).
Wait for the download to complete and then open the file.
When the installer is open, leave the default choice to Install for all users and click Next.
Click Next again.
If you are asked if you want to allow the program to make changes to your computer, click Yes.
Wait for the installer to complete then click Finish. PyGame is now ready to be used (see Figure A-2).
Windows 7
To install PyGame on Windows 7, follow these steps:
Open a web browser (such as Internet Explorer, Firefox or Chrome).
In the address bar, type pygame.org/download.shtml and press the Enter key.
When the page has loaded, scroll down to the Windows section and click on the pygame-1.9.1.win32-py2.7.msi link to download PyGame (see Figure A-3).
Once the file has downloaded, open it.
When the installer opens, leave the default choice to Install for all users and click Next.
Click Next again.
If asked if you want to allow the program to make changes to your computer, click Yes.
Wait for the installation to complete and then click Finish. PyGame is now ready to be used.
Mac
To install PyGame on your Mac, follow these steps:
Open a web browser (such as Safari, Chrome or Firefox).
In the address bar of the web browser, type in pygame.org/download.shtml and press Enter.
Once the webpage has loaded, scroll down to Macintosh.
Double-click the first file, which is called pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg (see Figure A-4).
Wait for the file to download.
Once the file has downloaded, open the Downloads folder.
Double-click on the file you just downloaded.
Right-click on the mpkg file and click Open With⇒Installer (see Figure A-5).
When the dialog box appears, click Open.
Now that the PyGame installer is open, click Continue.
Click Continue again.
Click Install.
If you’re asked for your password to give PyGame permission to install, enter your password.
Wait for PyGame to install.
PyGame has now successfully installed (see Figure A-6).
Go to the desktop and eject the PyGame disk image by right-clicking the disk image and selecting eject.
Linux (Ubuntu)
To install PyGame on Ubuntu Linux, follow these steps:
Open the dashboard and search for the terminal.
When the terminal has been found, click on it to open the terminal.
Once the terminal has loaded, type in the following command:
sudo apt-get update && sudo apt-get upgrade
If you are asked, type in your password.
Press Y if you are asked if you want to install updates.
Wait for the update to finish installing.
Enter this command to install PyGame (see Figure A-7):
sudo apt-get install python-pygame
Once again, press Y if you are asked if you want to install the new software.
Wait until the software finishes installation.
When the installation is finished, you can use PyGame with your Python programs.
Raspberry Pi
If you are using Raspbian on your Raspberry Pi, you are in luck—PyGame is already installed by default. This means you don’t need to do anything else to use PyGame with Python.
Downloading the Files for Adventures 8, 9 and 10
For Adventures 8, 9 and 10, you are provided with pre-made image and sound files. So that you can use these files with your programs, you need to download them and store them in the same folders/directories as your Python programs. To download the files on your computer, go to the section for your operating system and follow the instructions.
Windows 8
To download the files for your adventures on Windows 8, follow these steps:
Open a web browser (such as Internet Explorer, Firefox or Chrome).