Before you get started, you need the following basic materials:
There are many different computer operating systems, but the most common operating systems are Macintosh (Mac), Windows, and Linux. You should follow the installation steps that go with your operating system. There are some subtle but important differences between the systems.
For the projects in this book, we will be using Python 2.7. While there are higher versions than this (3.x), these versions do not work dependably with pygame on Windows, Mac, or Ubuntu Linux as yet. However, this book will be written to use conventions that work in both versions of Python so that projects are easily completed on Raspberry Pi (which uses Python 3.x that's been specially configured with pygame) with just a few modifications. These modifications will be duly noted.
Mac and Linux systems share enough similarities that people who use either Mac or Linux can follow the same set of instructions. These instructions will make note of any differences between Mac and Ubuntu Linux.
At the time of writing, Mac OS X El Capitan comes with Python 2.7 preinstalled, so nothing extra needs to be done at this point.
Ubuntu Linux 15.10 has Python 2.7.10 installed by default, so users of this latest (as of writing this) version of Linux also need to do nothing extra at this point.
Mac and Ubuntu Linux users have Python by default, but finding Python is tricky if you don't know where to look. There is a program called Terminal on both Mac and Linux operating systems. This program allows you to exercise a lot of control over your computer in these ways:
terminal
on their desktops, and the program will show up in their Start menu. When you click on the terminal, you will see a small, black window on your screen.A text editor is a helpful tool for writing and editing Python programs. The terminal is a nice place to test snippets of Python code, but when we want to edit and save the code in order to use it over again, we will need a text editor. Although both Mac and Linux systems come with a text editor, there are some very nice, free editors that have good features. jEdit is one of these editors.
For Mac and Linux, go to http://www.jedit.org/ and download jEdit. Follow the installation instructions.
To successfully complete all of the exercises in this book, you will often need to keep both the terminal and text editor open at the same time on your screen.
This is what the text editor application, jEdit, looks like in Mac and Linux:
Windows users, this setup might require help from your parents. Since Python is not installed by default on Windows, some system adjustments need to be made to successfully run Python on your computer. If you are feeling uncertain about performing these system changes yourself, make sure to ask for help:
Use the official Python website for the latest releases for Windows at https://www.python.org/downloads/release/python-2711/.
With Windows, you need to figure out if you are running 32-bit or 64-bit so that you can download the correct version of Python. To help you to determine which one is correct, visit
http://windows.microsoft.com/en-gb/windows/32-bit-and-64-bit-windows#1TC=windows-7.
Download x86only if your computer is running 32-bit Windows. Most users will download the x86-64 version of Python.
Python
in the Windows search bar. This will open a special Python shell from where you can run and test the Python code.In Windows 10, you will see a terminal called the command prompt. The command prompt is significantly different in Windows than it is on Mac or Linux.
To find the command prompt in Windows 10, perform these steps:
cmd
or command
.In Windows, Notepad is the default text editor. However, Notepad++ is a much better substitute.
To get Notepad++, perform these steps:
Notepad++ looks like this: