PyCon 2012 PyGame Tutorial Setup for OS X Lion

PyCon US 2012 had a talk given by Katie Cunningham and Richard Jones entitled "Introduction to Game Development". I figured it would be fun to follow along.

I've written this guide as a quick-start to anyone who didn't attend but needs resources and tools setup to follow the tutorial. I'm doing this on OS X 10.7.x Lion, so your setup may vary. * Install PyGame stable 1.9 for your machine:

I was unable to get the version from PyPI to install, it complained about a missing file. I used the pre-built version that is designed to work for Apple-supplied Python on Lion. Run the setup .mpkg and test that it installed successfully:

$ python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import pygame

If you don't get any major complaints then continue with setup. I did notice that movie and scrap modules could not be loaded successfully upon executing import pygame; help(pygame) but haven't investigated further.

  1. Setup a directory to mess around in:
$ mkdir ~/gamedev
  1. Grab the sample files from Richard's BitBucket repo by either downloading them or cloning the repo if you have Mercurial installed:
~/gamedev$ hg clone
  1. Test that it's all working:
~/gamedev$ cd pygame-tutorial
~/gamedev/pygame-tutorial$ python
  1. If everything is configured correctly, you should see a window flash on the screen momentarily. You should now be ready to follow the tutorial, I'll update this post if I encounter any issues along the way.

If you have a cool game project in mind, why not sign up for PyWeek? It's a game development challenge in which participants develop a game in Python over a week by themselves or a team. Registration should be open in a couple of weeks.


These are programs that Richard mentions in his presentation:

  • Tiled - Map editor which allows you to design and edit TMX files.
  • sfxr/cfxr - Sound file generator.