<p>El Paso Pygamers is for anyone in the El Paso area who wants to program video games.  We will use the <a href="http://www.python.org/">Python</a> programming langauge with <a href="http://www.pygame.org/">Pygame</a>.  (See [[ElPasoWhy]].)  These are serious programming tools that will let you build real games from scratch.</p>

<h3>Download</h3>

<p>For Microsoft Windows, please download and install <a href="http://www.python.org/ftp/python/3.1.4/python-3.1.4.msi">Python 3.1.4</a> and <a href="http://pygame.org/ftp/pygame-1.9.1.win32-py3.1.msi">Pygame 1.9.1</a>.  There is no Pygame for Python 3 on the Mac, so we won't support the Mac until there is.  And if you use Unix, I assume you can figure it all out for yourself.</p>

<h3>Tutorials</h3>

<p>Since there are plenty of great free Python tutorials available, there is no need to create a new one here.  Below is a list of them.  Look them over and read whichever one you like.</p>

<ul>
<li><a href="http://cs.simpson.edu/cmsc150/index.php">Computer Science With Python and Pygame</a>
<li><a href="http://inventwithpython.com/">Invent Your Own Computer Games with Python</a>
<li><a href="http://cscircles.cemc.uwaterloo.ca/">Computer Science Circles</a>
<li><a href="http://thinkcspy.appspot.com/build/index.html">How to Think Like a Computer Scientist</a>
<li><a href="http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3.0">Non-Programmer's Tutorial for Python 3</a>
<li><a href="http://docs.python.org/py3k/tutorial/">The Python Tutorial</a>
</ul>

<p>Note that we use Python 3, so you should read a tutorial for Python 3 not Python 2.  All of the above tutorials are for Python 3.</p>

<h3>Samples</h3>

<p>Please download [[pygamers.zip]].  This has the sample code that we will use.  It has the following structure:</p>

<ul>
	<li><b>basics</b> - This folder contains basic python programs to introduce you to what python can do.
	<li><b>draw</b> - This folder contains a number of python programs that draw things.
	<ul>
		<li><b>drawing.py</b> - This module makes drawing easier.  The other programs in this folder use this module.
		<li><b>drawing.html</b> - This contains <a href="http://docs.python.org/py3k/library/pydoc.html">pydoc</a> generated documentation of the drawing module.
	</ul>
	<li><b>game</b> - This folder contains a few simple games.
	<ul>
		<li><b>gaming.py</b> - This module is a very simple framework for Pygame that makes games a little easier to write.
		<li><b>gaming.html</b> - This contains <a href="http://docs.python.org/py3k/library/pydoc.html">pydoc</a> generated documentation of the gaming module.
	</ul>
</ul>

<p>Start with the <b>basics</b> folder.  With the help of the tutorials, you should be able to understand what each file in this folder does.  Look at the python files and run them and make sure that you understand the output.  Feel free to edit these files.  Playing with programs is what programming is all about.  One of the files is a guess-the-number game.  Copy it to another python file and try to change it to limit the number of guesses.</p>

<p>Next look at the programs in the <b>draw</b> folder.  To understand these programs, you should look at the documentation in <b>drawing.html</b>.  These programs draw a few different things including some national flags.  Try to write programs to draw other shapes, maybe other flags.  When you have mastered this, then look at <b>drawing.py</b> together with the <a href="http://www.pygame.org/docs/">Pygame documentation</a> and make sure you understand how it works.</p>

<p>Now you are ready for the <b>game</b> folder.  The games here use the <b>gaming</b> module, so look at <b>gaming.html</b> and <b>gaming.py</b> to understand how this module works.  Then look through the games.  When you understand the games in this module, you can try to write your own games.</p>

<p>Note that both the <b>drawing</b> module and the <b>gaming</b> module let you press the escape key to interrupt the program.  Then you can use the python command line to inspect variables or do whatever you want.  You can do <b>run()</b> from the command line to continue your program.</p>

<h3>Programming</h3>

<p>You become a programmer by playing with code (programs).  If you aren't sure how something works, just play with it and try things until you understand it.  You can edit any files in the samples.  After all, you can always download the samples again and start over.</p>

<p>Most tutorials will suggest that you program using <a href="http://www.annedawson.net/Python_Editor_IDLE.htm">IDLE</a>.  This is a tool that helps you write and run python programs.</p>

<p>Another option for running programs is to set the <a href="http://docs.python.org/py3k/using/cmdline.html?highlight=pythoninspect#envvar-PYTHONINSPECT">PYTHONINSPECT</a> environment variable.  This will run the python command line after your program is done.  You can edit your python programs with your favorite text editor and then run the programs directly.</p>

<h3>Getting Help</h3>

<p>We have an <a href="http://el-paso-pygamers.28036.n6.nabble.com/">El Paso Pygamers forum</a> where you can post questions.  There is also general Pygame [[info]].</p>

<p>We have weekly classes at <a href="http://www.stnicholas.tx.goarch.org/">St. Nicholas Church</a> on Thursdays from 1pm to 3pm in the building behind the church.  Please bring your laptop.</p>