pygame is

pygame.org is
PGU - Phil's pyGame Utilities

# PGU - Phil's pyGame Utilities - 0.7

### Description

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 peter.rogers-at-gmail.com if you're interested in taking over the code base, or becoming a contributor.

### Changes

**** Crazy API Update ****************************************************
Theme decorations are now seperate from the Widgets.  Thus:

* Widget._resize() was removed
* Widget.getspacing() was removed
* Widget.resize() returns None was changed to Widget.resize() returns w,h.
The container is responsible to do this:
widget.rect.w,widget.rect.h = widget.resize()
* Widget.chsize() was added, it requests that a widget be re-resize()ed --
similar to Widget.repaint()
* To disable the theme decorations on a widget:
widget = Widget(decorate=False)

**************************************************************************

- phil - added chsize() method which requests that a widget be re-size()ed.  (similar to repaint() or reupdate() except for the resize() method
- removed non-working hide,show calls
- fdarling - added a new table class that works a bit cleaner.  should
not have any noticiable API breaks.
- fdarling - reorganized pgu.gui to be a package

- added input type='file' to pgu.html
- fixed Toolbox bug (Toolbox.value = x wasn't working right)
- create circles in tileedit
- flip bkgr/tiles in leveledit

- tileedit / leveledit - illume added a feature where by you can check
a box to "auto-save" your tiles when you blur the window.  leveledit

- since the getwidths() feature was broken anyways, it has been removed
- when you create your main container for your app you _may_ need to
add align=-1, valign=-1 to get it in the top right corner the way
it used to be

- phil -- added Vera.ttf to theme, did some cleanup
- gal koren -- added a FileDialog, List,  misc patches, etc, added gui11, gui12 as demos of new features
- fdarling -- fixed some UI issues in Menu
- gal koren -- fixed a focus bug
- exampes, gui9 - -save/saveas are broken -- fname is set to a widget


### Screenshot

click to view original size

### Releases

 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

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 setup.py doesn't seem to do it.
March 16, 2011 8:18pm - Ken Lauer - nickname: (kne)
Great! I'm glad to see Python 3 support.

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:
http://www.burtonsys.com/email/

All I've done so far is this:

pgu\engine.py fixed tab/space mismatch (converted tabs to blanks)
pgu\text.py fixed tab/space mismatch
pgu\gui\area.py fixed tab/space mismatch
pgu\gui\input.py fixed text input for Python 3 (char/byte issue) on line 89:
c = e.unicode # was c = (e.str).encode('latin-1')
pgu\gui\table.py 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\textarea.py 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\theme.py Fixed a Python 3 bug: integer division is now // instead of / on line 420:
ww,hh=box.get_width()//3,box.get_height()//3
examples\gui6.py added pygame.quit() call at the end
examples\gui10.py added pygame.quit() call at the end
examples\gui11.py 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 build.py them
i did some simple changes to make it python 3.x compatible, basically, just:
1) 2to3.py
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 http://code.google.com/p/pgu/

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/theme.py", 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")
app.run(e)

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)
Theres a potential bug lurking in the actual package(0.12.1), wich manifest in the example gui9.py ( circles and boxes dont draw ).
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 "setup.py 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 "setup.py 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.
spotlight

our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.

recent releases
Aug 30, 2016

Aug 24, 2016

Aug 3, 2016

Aug 2, 2016

Aug 1, 2016

Jul 29, 2016

Jul 24, 2016

... more!

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