Here's my email address. Sorry, not linked, to avoid spam.

Contact Will McGugan

You could also tweet me.

Use Markdown for formatting
*Italic* **Bold** `inline code`

Links to [Google](

> This is a quote

import this
your comment will be previewed here
James Morris 7 years ago
Hello. I've been reading the book Beginning Game Development with Python and Pygame. It's a great read, fantastic actually, but I have trouble running the code… I get this in my console:

2009-03-08 19:34:03.228 Python Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.

And I don't understand it? I'm using Mac OSX 10.5 by the way. I'm not a pro programmer… I come from a PHP background (using MAMP) and so the whole Terminal concept is pretty new to me. I'm damn sure I have installed Python and Pygame correctly, as there is some Pygame examples I've been able to run fine. But it's annoying, I want to complete your book, but I can't with these errors… Like the ‘helloworld’ example, the image shows up in the background, I have a cursor image too, but it doesn't move, it's like it's frozen and it has that above error in the console.

I know you must be busy, but please help! I love your book and really want to complete it. If you need any information about my setup, please just ask me, do tell me how to find out versions though, as I'm new to the Terminal experience! Thank you Will! Great book… James
WIll McGugan 7 years ago

I'm afraid I can't help you with that one, not having a Mac. Perhaps you need to press a key in the terminal to move past the error message?

The pygame mailing list is probably the best place for help on this sort of thing…

Dan Koch 7 years ago
I was able to run the Chapter 3 demo just fine on Mac OS 10.5 (Leopard). Did you follow the instructions here when you installed MacPython? I opted to keep the system Python installed by Apple, but needed to follow these instructions to get PyGame to install.

The only thing extra I had to do was move the pygame files to the /Library/Python/2.5/site-packages folder. Also true for gameobjects.

The warning you mentioned is not a fatal error and is discussed here:

I am seeing some problems with the OpenGL examples. In Chapter 9, the example was missing a ball.png file, which can be easily fixed with your own image. More problematic is the lack of color for the example on my MacBook (nvidia GeForce 9400M) and HP 2710p tablet (Vista, Mobile Intel 965 Express). It displays fine on my Dell 490 (Fedora 10, nvidia Quadro FX 4600). Do you think this is a driver issue?

Jay 7 years ago
Hi there.

First of all, I would like to congratulate you on your book, “Beginning Game Development with Python and Pygame”. It's really helping me right now (with the PyWeek and all, hehe).

I'm writing to make a correction (so far, I've read up to page 36): in the 4th entry of the table 2-5, the description of the math.ceil function should be “Returns the smallest integer greater than or equal to a number”.

dlan1000 7 years ago

I was wondering if you have any experience integrating the python twisted networking module with pygame. I have encountered several approaches online to doing this (but no convergence on a good solution), and in a few your name was mentioned as someone that is pursuing this line of integration.

As an aside, I think your book Beginning Game Development with Python and Pygame is phenomenal, but one area that it is lacking is network support. Personally, I have a good deal of experience in many other languages, but I gravitate towards python and pygame because I think it enables rapid prototyping and proof of concept for small independent game efforts.
Will McGugan 7 years ago

Networking would have been a good topic to cover, but would be quite hard to do justice without several chapters – or an entire book.

I haven't tried integrating pygame and Twisted. I suspect that they wouldn't play well together, since they both want to monopolise the main loop.

One solution would be to run twisted in its own thread and communicate to the main pygame thread through a queue object (in the std lib). Then you could read new events from the queue prior to rendering. Although in some respects that defeats the purpose of using twisted in the first place.

An alternative approach would be to have an interface to the game state that is thread-safe, and have the pygame loop do rendering only. That would give you a more tradition event based model of the kind used in web servers.

Hope that helps!

Ken 6 years ago
Hi Will,

I'm in chapter 5 of your book BGDWPAP. I'm running MacPython 2.5 and pygame
on a iMac G5. When I try to run the code in Listing 5-8. Vector Magnitude Function,
I get the following error:

Traceback (most recent call last):
File “/Users/Ken/Desktop/”, line 22, in <module>
AB = Vector2.from_points(A, B)
File “/Users/Ken/Desktop/”, line 15, in from_points
return Vector2(cls, P2 - P1, P2 - P1)
TypeError: __init__() takes at most 3 arguments (4 given)

It looks like Vector2 might be the 4th argument? Is there a way around it?

At age 69 I'm brand new to programming, as a hobby, and your book has been most
helpful. I never took algebra, geometry or trigonometry. I guess this “Old Coot” better
crack a book or two.

Also, I tried to go to your site for the Game Objects
download as instructed in several places in the book, but the site can not be found.

Thanks, Ken

Looking forward to your next book.
Ken 6 years ago
Forgot my Email address.
Shaun Reapswaal 6 years ago
Hey will. First of all I read your book. And I do believe that it's the best book on game programming that I have ever read. Game programming simply comes so easily with it!!

I'm presently working on creating a 3D MMORPG with Python and intend on completing this project. For which I have to install PyOpenGL on my comp But the laptop that I want to install it on is not connected to the internet. But the I don't know how to install it, or acquire the setup file through the internet even on the computer that is connected to the internet. So I need your urgent help please.
Will McGugan 6 years ago
Hi Shaun,

If its Windows you will need to download the installer exe from and copy it to the machine you want to install it on. If its not Windows then download the source, unpack it and install it with ‘python install’.

Hope that helps!

Shaun Reapswaal 6 years ago
I checked it out. It's just so frustrating that both PyOpenGL and Python-OGRE aren't working on my system. Do you know Which one of those two is better performance-wise?
Will McGugan 6 years ago
Shaun, Couldn't say for sure, but OGRE will give you a complete game engine on which to build on, whereas with PyOpenGL you have start from scratch.
Page Lee 6 years ago
Hello, I've got your techblog source from google, and I want to run it, the path of the project like this: /home/pagelee/workspace/techblog, and I did not modify the code, except the database config.

Then I start the server using:
python runserver, and it started.

Then I access ""

My browser displayed:

Page not found (404)
Request Method: GET
Request URL:

No Blog matches the given query.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
I've tried many ways to handle it , but I was failed. So could you help me with it?
Thanks a lot.

Page Lee

from China
Page Lee 6 years ago
I handle it, just add a rootblog, is'nt it?
Will McGugan 6 years ago
Page Lee, I think you got it!
Page Lee 6 years ago
Thanks a lot! But I got another problem that why the index page displays only a half og it, that the left half, and if you are not the admin, you will not see the right half,such as the “popular Tags” “Comments” and so on.

Sorry to disturb you, I knew Django only two days ago.
tayfur yilmaz 6 years ago
hi ı saw the this site in and ı want to download the your sites code but this is not there.why did you erase your sites code
frederik 6 years ago
hello will i need to know how to nintendo ds games with python and pygame can you help me?
frederik 6 years ago
hello will i need to know how to make nintendo ds games with python and pygame can you help me
Mateus Cavanholi 6 years ago
Hi Will

I first come to your blog looking after the Vector2 source-code, the one you used in the Begining Game Developing with Python and Pygame, that I bought few days ago and it's really make me understand how it works.

And then I just take a look in another “stuff” of your blog and found the lucidesktop project.

It's seems amazing the idea to use a virtual desktop instead of bookmarks pages (even those that are rigorous organised become a mess with time)

So, after all this text, here is the question: Do you still have invites for this project (

And, as I'm here already: Do you planing to make any book a bit advanced of game developing?
Will McGugan 6 years ago
Mateus, there should be a few uses of this invite – if you are quick.

No plans for another book at the moment. One day though…
Stefan Mannsfeld 6 years ago
Hi Will,

I found your example very instructive and was browsing some of the accompanying libraries. I think in your vector library,, the __rsub__ operator should be
    def __rsub__(self, lhs):
        x, y, z = self._v
        ox, oy, oz = lhs[:3]
        return self.from_floats(ox-x, oy-y, oz-y)
        # orig has x-ox, ...
I haven't checked the other code, but these copy and paste bugs happen to me very frequently.
Erik 6 years ago
Mr. McGugan,

I need your help. I'm trying to use the PySndObj library ( to create computer sound, but I can't get it to work.

First, I downloaded (

Then, I extracted the contents of the download and placed it into the site-packages folder.

When I type “import sndobj” at the interactive prompt I receive a message that says “ImportError: No module named sndobj”. Why is there an import error?
Jonathan Hartley 6 years ago
I wanted to write a quick note to say thanks for your Beginning Game Development book.

I'm a software engineer who has dabbled in opengl on the side for years, but never really done anything other than scrappy proof-of-concept demos. I read your book over a year ago. At the time I really enjoyed reading it, but I had a reservation about it because I felt that it didn't really cover much that I didn't already know.

Since then though, I've started sitting down to actually write some small games, rather than just thinking ‘yeah yeah that looks easy, I could do that.’ During this time, I have found myself returning to your book again and again. I've undergone a bit of a transition away from my old arrogant attitude, and am much more appreciative of actually creating something, as opposed to simply thinking about it. I have found several instances where the difference between thinking I understand something in principle, and actually sitting down to do it, have turned out to be quite pronounced. :-)

Anyhow, all the ideas your talk about in your book are remarkably clearly expressed, and it has been a great source of reference for me to straighten my thoughts out when I'm in the thick of indecision about something. I have grown more and more appreciative of it as time has gone by. You did a really amazing job.

So, a sincere and belated thank-you.

Nejya 6 years ago
Hi Will!

I am reader of Your book and I am begginer in Pygame
First at all thank You for book. It's very nice of you
that you made it, and as far as I know there are not other
book about Pygame. Thought as a beginner, I have several remarks

Remark I
Your book Chapter 3, page 107:

A = (10.0, 20.0)
B = (30.0, 35.0)
AB = Vector2.from_points(A, B)
step = AB * .1
position = Vector2(A.x, A.y) #It's not going to work
for n in range(10):
position += step
print position

I changed it to A A but what did you mean

Second remark that at the certain points your book needs more exlanation than you gave. I mean this example wich you gave Chapter 7

class State(object):

def __init__(self, name): = name

def do_actions(self):

def check_conditions(self):

def entry_actions(self):

def exit_actions(self):

class StateMachine(object):

def __init__(self):
self.states = {}
self.active_state = None
def think(self):
if self.active_state is None:

self.active_state.do_actions()###### ???????????
new_state_name = self.active_state.check_conditions()
if new_state_name is not None:

I will be very thankful if You explain me
how can be here used method from different class. Because I don't see any obvious connecting point. So I am hardly trying to figure out that.
Patrick C. 6 years ago
Are there still invites to Loci Desktop, and if so is there a way I could get one. It seems like an awesome idea, and one that I have tried to achieve and failed at multiple times (scrolling links, mac style link dock, etc.) I would like to try this out.
Neil 6 years ago
Hi Will, I'm trying to download the code examples for Begining Game Development with Python and Pygame from the Apress site and something is broken! Download stops at 25%, then wants a new IP address. I've tried this 5 times already. Thought you should know…
Mirgorod 6 years ago
Hi Will!

Thanx to you for your book :)

But i got one problem when was trying to run listing 5-16…

I get this:

invalid destination position for blit

Class which was used:

class Vector2(object):
def __init__(self, x = 0.0, y = 0.0):
self.x = x
self.y = y
def __str__(self):
return “(%s, %s)” % (self.x, self.y)
def from_points(P1, P2):
return Vector2(P2 - P1, P2 - P1)
def get_magnitude(self):
return math.sqrt(self.x**2 + self.y**2)
def normalize(self):
magnitude = self.get_magnitude()
self.x /= magnitude
self.y /= magnitude
def __add__(self, rhs):
return Vector2(self.x + rhs.x, self.y + rhs.y)
def __sub__(self, rhs):
return Vector2(self.x - rhs.x, self.y - rhs.y)
def __neg__(self):
return Vector2(-self.x, -self.y)
def __mul__(self, scalar):
return Vector2(self.x * scalar, self.y * scalar)
def __div__(self, scalar):
return Vector2(self.x / scalar, self.y / scalar)

I need your help :)
Mirgorod 6 years ago
I haven't this problem already :)
Rune 5 years ago
I am reading you fantastic book Beginning Game Development with Python and PyGame. Your example in chapter 9, the cube world-example, seems to me a bit overwhelming. I have tried to use the information given simply to draw shapes in 3D enivroments with OpenGL.

I was hoping you could explain me why my code does not show the square I want it to do.

SCREEN_SIZE = [640, 480]
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import*
from math import radians
from sys import exit
def resize(width, height):
    glViewport(0,0, width, height)
    gluPerspective(60., float(width)/height, .1, 10000.)
def init():
    glClearColor(1.0, 1.0, 1.0, 0.0)
screen = pygame.display.set_mode(SCREEN_SIZE, HWSURFACE|OPENGL|DOUBLEBUF)
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
    glColor(1.0, 0.0, 0.0, 0.0)
    glVertex(100.0, 100.0, 100.0)
    glVertex(200.0, 100.0, 100.0)
    glVertex(200.0, 200.0, 100.0)
    glVertex(100.0, 200.0, 100.0)

Thanks in advance.
Espen 5 years ago
Dear Sir,
Do you know if your book is sold anywhere as PDF?
Amazon only want to sell me paperback and kindle version.

Espen 5 years ago
Found it at
Michael 5 years ago
Hello Will.
Ive recently began learning Python and Pygame and have been hunting throughout the interwebs for various tutorials and guides on the two. Your site is and excelent resource for both (and has even sparked my curiosity in django)

Im currently stuck on pathfinding and have been looking for diffrent way people implement it. Your Fugu demo has helped and im also intrested in the Fugu's Friend demo (A* seems to be the way to go with pathfinding) Unfortunatly the link to the demo isnt working anymore and i was hoping you may have the .zip still stored somewhere? Googling for it hasnt helped at all.

The post in question is this is over 3 years so the likelyhood of finding it is slim i know but still worth asking.

Thanks, Michael.
Will McGugan 5 years ago
Sorry, Michael. Couldn't find it!
Michael 5 years ago
Oh well, thank you for looking.
Thalysson Davyd [from Brazil] 5 years ago
sorry my bad english, I'm still learning the English language, as well as I am new to programming

first congratulations on the book Beginning Game Development with Python and Pygame…, great book. I've done some games using pygame .. and now I'm starting to make a snake-style game using OpenGL. I read the chapters of the book on the subject but I'm still a little “lost” in the sense of how I will make the game! I have in mind as early concepts of primitives, textures…

be able to help with any tutorial or suggesting a book (using python in the examples, not the language of c or c + +) or someone who can connect with and ask questions thank you very much.
Sean 5 years ago

i recently bought your book “Beginning Game Development with python and pygame : from novice to professional”

i have python 2.7.1

i have windows vista

i am currently reading chapter 2 and i typed both and correctly in the sciTE text editor

when i try to run the out put is

>pythonw -u “”
>The system cannot find the file specified

and when i do a syntax check this comes up

>python -c “import py_compile; py_compile.compile(r'C:\Users\Sean\Documents\')”
'python' is not recognized as an internal or external command,
operable program or batch file.
>Exit code: 1

how do i get the to run correctly like it does in the book
Shaun Reapswaal 5 years ago
Wassup Free Willy?!! hehe! xD

Well anyway, will since yours was the best book on game development that I have “ever” read. I was wondering why have you not written any other books since then? I mean I have been waiting and it's been ages or so. Don't you like writing or teaching or something?

Well have you ever thought of writing a book on Python Ogre? hopefully using Python 3.0 Python-Ogre does not support it as yet, but it's about to. Should be complete any day now :P
Will McGugan 5 years ago
@Sean, no plans to write another book in the short term I'm afraid. But I would love to write another one.

I haven't tried Python Ogre. It looks pretty cool though…
Shaun Reapswaal 5 years ago
It sure is cool Will! But it can be much better, the people working on it are either not skilled enough or they aren't enough in numbers. Well anyway, if you would love to write a book then why don't you have any plans in the short term?
emilio 4 years ago
hi mr will i was reading your book of pygame and i have a problem with vector in the exameple 6-2 simply directional movement and in others when i write
screen.blit.(sprite, sprite_pos) said invalid destination position for a blit i dunno why it said that would you mind helping my and the vector class is defined
Fabronchis 4 years ago
Hello .. I'm from Argentina. Sorry for my bad english. I want to use “djangotechblog” for build my cheff blog. My question is: DjangoTechBlog managment users account? I want to check all the post. I don't like that all people post. I want to avoid abuse, irrelevant comment, …

Another Question:
What type of licence djangotechblog have?
Requiere your signature?

Sagar Gupta 4 years ago
Hello. I've been reading the book Beginning Game Development with Python and Pygame, and i am facing problem in using scite while i press the run button it will show the following problem…
“pythonw -u ”“
>The system cannot find the file specified.”

Please help i am using windows 7 operating system
Sagar Gupta 4 years ago
please Help!!!
din 4 years ago
hi will ur book is a fantastic read i'm in the middle of it but from two days or so my computer is not even opening python application and it is showing error message i.e(socket error : conection refused,idle's subprocess didn't make the conection please tell me a solution i'm using windows 7 ultimate version)
Tai 4 years ago
Hi! i'm reading ur pygame book :D and i dont understand this code:

heading *= movement_direction

what does * do in this line?
Neil 4 years ago
hello will
i have a little problem with donloading and installing the gameobjects library, gameobjects-0.0.3.win32.exe dosen't work on my computer so i tried the version but when i try to run the setup file it dosen't work and this error shows up:

Game Objects v0.0.3
Traceback (most recent call last):
File “C:\Python25\Lib\site-packages\gameobjects-0.0.3\”, line 31, in <module>
classifiers = classifiers.splitlines(),
File “C:\Python25\lib\distutils\”, line 139, in setup
raise SystemExit, gen_usage(dist.script_name) + “\nerror: %s” % msg
SystemExit: usage: cmd1 [cmd2 …]
or: –help
or: –help-commands
or: cmd –help

error: no commands supplied

and when i try to import it with IDLE it cannot find gameobjects.vector2

can you help with this ??
Asgar 4 years ago
Can you tell me how to do the effect while mouse dragging the canvas.

Thanks in advance
kowthal ganesh 3 years ago
Hi sir,
This is ganesh with you, had a doubt, is it possible to draw the pencil, circle, rectangles, at text view in python, else there is only way to draw the things in drawing area, how can i improve smoothness of pencil tool, is there any suitable package on available to import the drawing environment,..
please clarify myself,

Thanks in advance
Anton Zepherin 3 years ago
Hi Will,

Just saw your tweet and thought i'd get in touch as I'm after for a Python Developer for a 6 week remote opportunity to start immediately.

If you're available and interested please get in touch as soon as possible at 0207 269 6784 or you can reach me at

Merlink 2 years ago
Hi Will,

I modified your what in my mind is a really great and simple chess lib. I want to combine it with PyBitmessage to use it as P2P Serverless chess implementation.

Could I put my modified version to github and publish it there?

If yes, what licenses are possible?

Best regards,

Kenny Prestom 9 months ago
Hi Will:

I'm so glad to discover your site while looking for a script to use for a welcome/splash page for a website. I've tried many sliders with the ken burns effect, but they provide start and end points for the panning only as top, left, bottom etc, which are not accurate enough for this project.
I suspect precise start and end coordinates for panning could probably be set in your script, which is exactly what I need.

When you get the opportunity, would you please give an example of how the entire randomization part of your script may be replaced by just one start point and one end point?


Aleki 9 months ago
hi again,

Its time to finally move your projects to git. Even google suggests move to now.

Google is a big barrier for me, keeping me from contributing.
Tanner 8 months ago
Hello, I am not for sure if your familiar with Tkinter, but if you are i kinda of need some help on how to give a restart button a restart function or tell the restart button what to do.Email me as quick as you can please


from tkinter import*
import random
import time

class Ball:
def __init__(self, canvas, paddle, color): = canvas.create_oval(10, 10, 25, 25, fill=color)
self.paddle = paddle
self.canvas = canvas
canvas.move(, 232, 276)
starts =
self.x = starts
self.y = -3
self.hit_bottom = False
self.speed = 0.01

def hit_paddle(self, pos):
paddle_pos = self.canvas.coords(
if pos >= paddle_pos and pos <= paddle_pos:
if pos >= paddle_pos and pos <= paddle_pos:
self.x += game.paddle.x
return True
return False

def draw(self):
self.canvas_width = self.canvas.winfo_width()
self.canvas_height = self.canvas.winfo_height()
self.canvas.move(, self.x, self.y)
pos = self.canvas.coords(

if pos <= 0:
self.y = 3
if pos >= self.canvas_height:
self.hit_bottom = True
if self.hit_paddle(pos) == True:
self.y = -3
if pos <= 0:
self.x = 3
if pos >= self.canvas_width:
self.x = -3

class Paddle:
def __init__(self, canvas, color): = canvas.create_rectangle(0, 0, 100, 10, fill=color)
self.canvas = canvas
canvas.move(, 200, 300)
canvas.bind_all(“<KeyPress-Left>”, self.turn_left)
canvas.bind_all(“<KeyPress-Right>”, self.turn_right)
canvas.bind_all(“<space>”, self.start_game)
self.started = False
self.x = 0

def draw(self):
self.canvas_width = self.canvas.winfo_width()
self.canvas.move(, self.x, 0)
pos = self.canvas.coords(
if pos <= 0:
self.x = 0
elif pos >= self.canvas_width:
self.x = 0

def turn_left(self, evt):
self.x = -2

def turn_right(self,evt):
self.x = 2

def start_game(self, evt):
self.started = True

class Score:
def __init__(self, canvas, color):
self.value = 0
self.canvas = canvas = canvas.create_text(10,\
12, \
font=(“Purisa”, 14), \
text=“Score: ” + str(self.value), \
anchor=“nw”, \
def hit(self):
self.value += 1
self.canvas.itemconfig(, text=“Score: ” + str(self.value))

def clear(self):
self.value = 0
self.canvas.itemconfig(, text=“Score: ” + str(self.value))

class Game:

def __init__(self):
# Create canvas
self.canvas = Canvas(tk, width=500, height=400, bd=0, highlightthickness=0)
# Initialize restart button
self.restart_button = None
# Create game elements
self.score = Score(self.canvas, “black”)
self.paddle = Paddle(self.canvas, “blue”)
self.ball = Ball(self.canvas, self.paddle, “red”)
self.game_over_text = self.canvas.create_text(250, \
200, \
font=(“Purisa”, 50), \
fill=“red”, \
text=“GAME OVER”, \

def add_restart(self):
self.restart_button = Button(tk, text=“RESTART GAME”, \

def restart(self):
self.canvas.itemconfig(self.game_over_text, state='hidden')
# Reset score
# Reset paddle
self.paddle.x = 0
self.canvas.move(, self.paddle.x, 0)
# Reset ball
self.ball.canvas.move(, 232, 276)
starts =
self.ball.x = 0
self.ball.y = -3
self.ball.hit_bottom = False
self.ball.speed = 0.01

tk = Tk()
tk.wm_attributes(“-topmost”, 1)

game = Game()

while 1:
if game.ball.hit_bottom == False and game.paddle.started == True:
if game.ball.hit_bottom == True:
game.canvas.itemconfig(game.game_over_text, state='normal')
game.paddle.started = False
if game.restart_button is None:

Tanner 8 months ago
That was what i had for the game i made