Appendix-image

Installing PyGame

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:

  1. Open a web browser (such as Internet Explorer, Chrome or Firefox).
  2. In the address bar, type pygame.org/download.shtml and press the Enter key.
  3. When the page loads, scroll down to the Windows section.
  4. Click on the pygame-1.9.1.win32-py2.7.msi link to begin downloading the file (see Figure A-1).
    image

    FIGURE A-1 Installing PyGame on Windows 8

  5. Wait for the download to complete and then open the file.
  6. When the installer is open, leave the default choice to Install for all users and click Next.
  7. Click Next again.
  8. If you are asked if you want to allow the program to make changes to your computer, click Yes.
  9. Wait for the installer to complete then click Finish. PyGame is now ready to be used (see Figure A-2).
image

FIGURE A-2 PyGame ready to be used on Windows 8

Windows 7

To install PyGame on Windows 7, follow these steps:

  1. Open a web browser (such as Internet Explorer, Firefox or Chrome).
  2. In the address bar, type pygame.org/download.shtml and press the Enter key.
  3. 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).
    image

    FIGURE A-3 Installing PyGame on Windows 7

  4. Once the file has downloaded, open it.
  5. When the installer opens, leave the default choice to Install for all users and click Next.
  6. Click Next again.
  7. If asked if you want to allow the program to make changes to your computer, click Yes.
  8. 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:

  1. Open a web browser (such as Safari, Chrome or Firefox).
  2. In the address bar of the web browser, type in pygame.org/download.shtml and press Enter.
  3. Once the webpage has loaded, scroll down to Macintosh.
  4. Double-click the first file, which is called pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg (see Figure A-4).
    image

    FIGURE A-4 Python packages for Mac

  5. Wait for the file to download.
  6. Once the file has downloaded, open the Downloads folder.
  7. Double-click on the file you just downloaded.
  8. Right-click on the mpkg file and click Open With⇒Installer (see Figure A-5).
    image

    FIGURE A-5 Installing PyGame on Mac

  9. When the dialog box appears, click Open.
  10. Now that the PyGame installer is open, click Continue.
  11. Click Continue again.
  12. Click Install.
  13. If you’re asked for your password to give PyGame permission to install, enter your password.
  14. Wait for PyGame to install.
  15. PyGame has now successfully installed (see Figure A-6).
    image

    FIGURE A-6 PyGame ready to be used on Mac

  16. 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:

  1. Open the dashboard and search for the terminal.
  2. When the terminal has been found, click on it to open the terminal.
  3. Once the terminal has loaded, type in the following command:

    sudo apt-get update && sudo apt-get upgrade

  4. If you are asked, type in your password.
  5. Press Y if you are asked if you want to install updates.
  6. Wait for the update to finish installing.
  7. Enter this command to install PyGame (see Figure A-7):

    sudo apt-get install python-pygame

    image

    FIGURE A-7 Installing PyGame on Linux

  8. Once again, press Y if you are asked if you want to install the new software.
  9. Wait until the software finishes installation.
  10. 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:

  1. Open a web browser (such as Internet Explorer, Firefox or Chrome).
  2. In the address bar, type www.wiley.com/go/adventuresinpython and press Enter.
  3. Scroll down to the link named Downloads and click on it to download the files.
  4. Open the folder that the file downloaded to.
  5. Right-click on the file and click Extract All…
  6. Click Browse and find the Adventures in Python folder that you created in the first adventure.
  7. Click Extract.
  8. The folders and files are now in the correct location for Adventures 8, 9 and 10.

Windows 7

To download the files for your Adventures on Windows 7, follow these steps:

  1. Open a web browser (such as Internet Explorer, Firefox or Chrome).
  2. In the address bar type www.wiley.com/go/adventuresinpython and press Enter.
  3. Scroll down to the link named Downloads and click on it to download the files.
  4. Open the folder that the file downloaded to.
  5. Right-click on the file and click Extract All…
  6. Click Browse and find the Adventures in Python folder that you created in the first adventure.
  7. Click Extract.
  8. The folders and files are now in the correct location for Adventures 8, 9 and 10.

Mac

To download the files for your Adventures on Mac OS X, follow these steps:

  1. Open a web browser (such as Safari, Firefox or Chrome).
  2. In the address bar, type www.wiley.com/go/adventuresinpython and press Enter.
  3. Scroll down to the link named Downloads and click on it to download the files.
  4. Open the folder that the file downloaded to.
  5. Right-click on the file, move the mouse over Open With and click Archive Utility.
  6. Drag the Adventure 8, Adventure 9 and Adventure 10 folders to the Adventures in Python folder that you created in the first adventure.
  7. The folders and files are now in the correct location for Adventures 8, 9 and 10.

Linux (Ubuntu)

To download the files for your Adventures on Linux, follow these steps:

  1. Open a web browser (such as Firefox or Chromium).
  2. In the address bar, type www.wiley.com/go/adventuresinpython and press Enter.
  3. Scroll down to the link named Downloads and click on it to download the file.
  4. Open the folder that the file downloaded to.
  5. Right-click on the file and click Open With Archive Manager.
  6. Click Extract and find the Adventures in Python folder that you created in the first adventure.
  7. Click Extract.
  8. The folders and files are now in the correct location for Adventures 8, 9 and 10.

Raspberry Pi

To download the files for your Adventures on Raspberry Pi, follow these steps:

  1. Open a web browser (such as Midori or Chromium).
  2. In the address bar, type www.wiley.com/go/adventuresinpython and press Enter.
  3. Scroll down to the link named Downloads and click on it to download the files.
  4. Open the folder that the file downloaded to.
  5. Right-click on the file and click Open With Archive Manager.
  6. Click Extract and find the Adventures in Python folder that you created in the first adventure.
  7. Click Extract.
  8. The folders and files are now in the correct location for Adventures 8, 9 and 10.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.80.209