pygame is
Simple DirectMedia Layer is
Site Swing
PGU - Phil's pyGame Utilities

PGU - Phil's pyGame Utilities - 0.16

Peter Rogers (petros)



Simple GUI widgets for use in pygame. (eg buttons, text boxes, windows, etc) NOTE: PGU is in need of a new maintainer. Please email me at if you're interested in taking over the code base, or becoming a contributor.


This version should be more or less compatible with python3 (except for the html rendering code, which is half-working).


Home Page:


click to view original size


PGU - Phil's pyGame Utilities - 0.16 - Mar 16, 2011
PGU - Phil's pyGame Utilities - 0.14 - Jan 3, 2011
PGU - Phil's pyGame Utilities - 0.12.2 - Mar 1, 2009
PGU - Phil's pyGame Utilities - 0.12.1 - Feb 23, 2009
PGU - Phil's pyGame Utilities - 0.10.6 - Mar 25, 2007
PGU - Phil's pyGame Utilities - 0.10.5 - Sep 1, 2006
PGU - Phil's pyGame Utilities - 0.10.3 - Apr 7, 2006
PGU - Phil's pyGame Utilities - 0.10.2 - Mar 13, 2006
PGU - Phil's pyGame Utilities - 0.10.1 - Feb 24, 2006
PGU - Phil's pyGame Utilities - 0.10 - Feb 11, 2006
PGU - Phil's pyGame Utilities - 0.9 - Dec 1, 2005
PGU - Phil's pyGame Utilities - 0.7 - Nov 19, 2005
PGU - Phil's pyGame Utilities - 0.6 - Oct 24, 2005
PGU - Phil's pyGame Utilities - 0.5 - Oct 7, 2005
PGU - Phil's pyGame Utilities - 0.3 - Aug 25, 2005
PGU - Phil's pyGame Utilities - 0.1.0 - Aug 4, 2005
PGU - Phil's pyGame Utilities - 0.1.0pre - Jul 24, 2005 account Comments

If you wish to leave a comment with your account, please sign in first.

November 18, 2011 3:29am - J - nickname: (dobus)
And I've got python 2.6 with pyGame running fine.
November 18, 2011 3:28am - J - nickname: (dobus)
How do you install PGU on Windows 7? Just running doesn't seem to do it.
March 16, 2011 8:18pm - Ken Lauer - nickname: (kne)
Great! I'm glad to see Python 3 support.
February 18, 2011 12:10am - Muhammad Ahmad Tirmazi - nickname: (burningprodigy)
I have added your utilities along with my game for the convenience of downloaders.
I have given you full credit for the work. See:

If you have any objection just tell me and i will remove them immediately
January 12, 2011 10:03am - Dave Burton - nickname: (ncdave4life)
Victor, would you mind sharing your Python3 work with me? You've obviously gotten further down that trail than I have. My email address can be found here:

All I've done so far is this:

pgu\ fixed tab/space mismatch (converted tabs to blanks)
pgu\ fixed tab/space mismatch
pgu\gui\ fixed tab/space mismatch
pgu\gui\ fixed text input for Python 3 (char/byte issue) on line 89:
c = e.unicode # was c = (e.str).encode('latin-1')
pgu\gui\ fixed a Python 3 bug (None is not equivalent to 0); insert before line 325:
if width == None:
width = 0
if height == None:
height = 0
pgu\gui\ converted tabs to blanks, and fixed a Python 3 bug (char/byte issue) on line 244:
c = e.unicode # (e.str).encode('latin-1')
pgu\gui\ Fixed a Python 3 bug: integer division is now // instead of / on line 420:
examples\ added pygame.quit() call at the end
examples\ added pygame.quit() call at the end
examples\ fixed tab/space mismatch
January 10, 2011 4:39pm - eduardo zepeda - nickname: (edzep)
I appreciate these utilities by Peter and Phil. Anyone know of a way to put focus on a PGU input box? I've studied the code, and there does not appear to be. But, I may have missed something.
January 10, 2011 3:42am - Victor Kam - nickname: (lingyis) - 5/5
thanks for the update
docs are there, just need to them
i did some simple changes to make it python 3.x compatible, basically, just:
2) fix some indentations
3) some range() issues--floats no longer automatically casted into ints in 3.x
4) max() issues--None type no longer automatically casted into 0
5) htmllib issue: import html.parser instead, use html.parser.HTMLParser. the next step not sure what i did is right, but the p = _html(htmllib.AS_IS,0) line, the new HTMLParser does not need arguments for its constructor so i left those arguments out. the html examples run without crashing, i just don't know if the behavior is as intended for such. anyway, i have no need for the html stuff so i'm pretty happy.
January 9, 2011 5:23pm - Gregor Lingl - nickname: (glingl)
It seems to me that in PGU 0.14 the docs are missing.
Regards, Gregor
January 4, 2011 7:53pm - Peter Rogers - nickname: (petros)
Okay folks, sorry for the delay in releases. The latest (0.14) should fix many of the problems people have been having.

If you checkout the googlecode site, there's an issue tracker you can use to submit bug reports and whatnot.
January 4, 2011 9:51am - Donpachi - nickname: (donpachi) - 5/5
Great work, it's the first pygame library that stuck with me. Now I can't do anything without it anymore.
September 28, 2010 9:04pm - Carlos Guidobono - nickname: (masterguido)
Where can I find info about pgu? Properties, methods, classes?
Thank you
April 19, 2010 4:25pm - Niriel - nickname: (niriel)
I'm having troubles with the last version: 0.12.2. ComboBoxes (gui.Select) won't unfold but will crash with a "Button instance has no attribute '_container_bkgr'". Also, menu items are properly shown the first time I click on the menu, but after the first time they'll be invisible until I move my mouse cursor above them.
April 11, 2010 2:48am - Amey - nickname: (szcukg)
I have a gui button.When a button click happens I want to load a new python script which should blit the current page.How can I do this
April 11, 2010 12:46am - Karanveer Singh - nickname: (kvsingh) - 5/5
I'm having a problem. Basically I want to do collision detection of 2 sprites with the same type of tiles. So, I don't know what to enter in the tdata dictionary. I tried entering both sprites, but it only does collision detection for the sprite entered later. How can I do collision detection for both the sprites with the same type of tiles?
March 30, 2010 6:28am - Connor Walker - nickname: (awesumo)
i am getting the same error as "supersailor7"
i am running it of the command prompt and it seems every command i put after the file location leads to it returning that it cant find the folder 'pgu'
March 17, 2010 12:40am - Jordan Magnuson - nickname: (jordanmagnuson)
Is this module still being maintained? Does it work with the latest version of PyGame (1.9.x)?
February 8, 2010 6:41am - stas - nickname: (stas)
As I can't seem to find the current maintainer of pgu I'll try this comments list.

The changelog above mentions that the container.remove bug is fixed but it's still there in version 0.12.3.
The widget is still shown at the screen, it's not functional, but still visible.

September 4, 2009 12:18pm - Marco Baxemyr - nickname: (phelerox)
pywiz32: There's a 0.12.3 version here

No idea what it does, but try and hope? I hope there will be a fix in time for my upcoming project! :)
August 24, 2009 12:48pm - Anonymous - nickname: (pywiz32)
A new problem has risen from the new version of pygame: the menus only open once. Basically, you can open them, but after you close that menu, it won't re-open.
June 15, 2009 11:11am - Chris Carton - nickname: (ctcarton)
I get this exception when running the examples:

File "../pgu/gui/", line 483, in paint
if isinstance(v, pygame.Color) or type(v) == tuple:
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
April 13, 2009 9:54am - Roman Lavrov - nickname: (rlavrov)
Surprisingly mouse wheel is not supported in GUI.
Here is a patch fixing this:
March 23, 2009 11:27am - Claudio Canepa - nickname: (claxo)
petros, are you tracking the issues in the project page ?
March 1, 2009 12:08pm - Peter Rogers - nickname: (petros)
This sounds like an issue with the old version of PGU (0.11.6) - could you make sure you've installed the latest version?
February 24, 2009 9:24pm - liam mcadney - nickname: (liam)
I am doing a starter example like:

from pgu import gui
app = gui.App()
e = gui.Button("hello world")

and i keep getting this error: AttributeError: 'int' object has no attribute 'size' ---- what am i missing??
February 24, 2009 4:21pm - Claudio Canepa - nickname: (claxo)
Glad pgu is active again.
Theres a potential bug lurking in the actual package(0.12.1), wich manifest in the example ( circles and boxes dont draw ).
Look at the thread for more info
February 23, 2009 11:56pm - Ken Lauer - nickname: (kne)
Good to see someone's maintaining this now. Keep up the good work.
February 2, 2009 11:31pm - Mako Kino - nickname: (supersailor7)
When I attempt the install (with the " install" command) I get the error message "error: package directory 'pgu' does not exist." But there IS a folder "pgu" in the directory. Now what?
January 1, 2009 3:11pm - Anonymous - nickname: (pywiz32)
While using pgu, I found several areas of possible improvement. 1: you can't put several connections per event. the way you do it, you can have one per event. It would help to have several possible. 2: function calls from connected events don't work if it's built-in. Built-ins don't have function codes, and pgu requires them. It would be great to fix this.
March 19, 2008 1:26pm - John coyne - nickname: (coynemultimedia)
Try opening a dos window, navigate to the PGU dir and type " install".
It worked for me.
February 7, 2008 8:03am - AN - nickname: (an) - 5/5
pymike, use 7-zip.
if you can't install software, use 7-zip portable on a usb stick.
Even though it is an installer, it only extracts files.
December 3, 2007 5:14pm - pymike - nickname: (pymike)
Can you release a zip download so I can use it? I can't unpack .gz files.

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)