Table of Contents
Step 000 - Installation, Documentation and Examples
Pygame is not shipped together with Python, it is a 3rd-party-package. To install it on your computer you need a version of Python installed correctly on your computer that works good together with Pygame:
- Python2.x (recommended)
- or Python 3.x (experimental)
Mostly yes. Only the scrap, _movie, surfarray for Numeric, and threads modules have not been ported. The Pygame alternative, pgreloaded (Pygame Reloaded), also supports Python 3.
|Linux|| Users of Ubuntu Linux can type:
|Windows||Install pygame from http://www.pygame.org/download.shtml|
|Mac||Install pygame from http://www.pygame.org/download.shtml|
|source||installing from source : http://www.pygame.org/download.shtml|
If you have no internet access, you can still read pygame's documentation offline in your browser. Just open the file
index.html in pygame's
docs folder. The File should be located inside your python installation:
pygame will install a bunch of highly useful examples inside the folder
/dist-packages/pygame/examples. It is a good idea to copy the whole
example folder (including his sub-folders
macosx) to another location like to your desktop. In that way, you can modify all pygame examples without destroying the originals.
A short description of each pygame example can be found at pygames documentation homepage:
Open a terminal and type:
python -m pygame.examples.aliens
The Editor and Other Tools
To modify the python source code files (.py) in your favourite text editor, make sure that you are able to load, modify and start python files using your editor. Try to open and start the aliens example from within your text editor. Every OS is shipped with at least one very simple text editor, and python usually installs the IDLE text editor on your system. For a list of text editors and IDE and their features see http://wiki.python.org/moin/PythonEditors
For the next chapters, it is helpful if you know how to paint and modify images, especially in the .png format. Most image editors / viewers can display those graphics (even your webbrowser) but not every image editor can handle transparency (transparent backgrounds).
You can download and install the free and open source image editor GIMP for every operation system, althoug you will only need very few of it's functions for the next chapters. A simple image viewer with rudimentary editing functions such as IrfanView for Windows or gthumb for Linux may be sufficient.
For the next chapters, it is helpful if you can generate and manipulate (and record!) sound effects on your computer. You need functions to cut parts of recorded sound effects and ideally a noise reduction. Both functions are provided by the free and open source program audacity, wich can also generate sounds.
For an specific sound effect generator, you may try out http://www.drpetter.se/project_sfxr.html
Download from Github
Source code examples and other necessary files like graphics and sounds will be hosted not on this wiki, but instead on github. While it is not necessary to create an account at github.com to download all code examples for this book, it may be useful if you want to publish your edits / comments back into this wiki.
What you should know however is how to download code and files directly from github:
- Open this URL in your browser: https://github.com/horstjens/ThePythonGameBook
- and click on the big Downloads icon.
- choose Download .tar.gz for Linux, or Download .zip for Windows
- extract the archive file on your Desktop. All neccessary files for the next chapters are inside the
Now you are ready, start with step001 and write your first pygame program !