backlinks to this page:
Github:
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:
<note warning>from Pygame FAQ: Does Pygame work with Python 3?
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. </note>
Linux | Users of Ubuntu Linux can type: sudo apt-get install python-pygame or install pygame using synaptic or the ubuntu software center. |
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 |
You can view the pygame documentation online at:
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: /dist-packages/pygame/docs/index.html
Linux | /usr/lib/python2.6/dist-packages/pygame/docs/index.html |
Windows | ? |
Mac | ? |
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 data
and 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:
Now it is time to enjoy your successfull installation of python and pygame. How about a round of mindless alien shooting ?
Open a terminal and type:
python -m pygame.examples.aliens
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
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:
pygame
folder
Now you are ready, start with step001 and write your first pygame program !
~~DISQUS~~