Skip to main content

PGU - Phil's pyGame Utilities - 0.10.5

A collection of handy modules and scripts for PyGame.

Peter Rogers
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.


- added: support for style loading .ini files 
color: red
color: blue
.. etc ..
- changed: filedialog now uses the dialog class for most all of its
parts.  main style change is that
filedialog.title.label => dialog.title.label
and all other filedialog items are gone, except for 
- changed: filedialog style requirements to be much simpler.  in general
it just uses dialog and default labels, etc now.
- fixed: some excessive repaints going on due to use of chsize() before a paint().
now chsize() doesn't do anything until after the widget is painted at least once.
- fixed: some code in VScroll, HScroll that was causing extra resizes within tables
for no particularily good reason.
- fixed: menu not working bugs 
- changed: menu so that the cls of a menu doesn't change, it just keeps
the down pcls while down.
- fixed: bug where get_abs_rect() was wrong due to theme stuff... kind of a HACK
- added: shift-TAB for previous support
- fixed: bug where TAB could cause a crash if no non-container widget
    was in focus at the time.
- changed: added support for width,height scaling for Image widgets
- changed: improved caching of style data so that complex screens repaint much quicker (removed .cache() method from style object)
- changed: misc changes to add better keyboard / nav support to many widgets (selects, sliders, etc)
- added: ability to move between widgets via arrow keys .. to stop this behaviour, make sure the
widget that has focus returns True to say that it "already used the event"
- changed: after an event() handler, user should return try if they used
    the event.  otherwise a container may use the TABS, arrow keys, etc for
    navigation or other purposes.  somewhat optional, will only impact
    widgets that use tabs/arrow keys ATM.
- added: a Link widget
- fixed: bug where pygame would crash if full screen was toggled 
- fixed: some style issue in the select widget
- fixed: some rendering issues with sliders being off by a few pixels
- fixed: some icon styling bugs due to incorrect init order.. but i'll still probably
    deprecate it anyways! ha!
- fixed: backgrounds of widgets that are getting repainted, etc.
- fixed: disabled backgrounds that didn't appear correctly

0.10.4 -
- fixed: bug in -- directories with '!' at beginning were being sorted after '..'
        thanks Jason Liu for this patch
- fixed: bug in
- fixed: scrollbars scroller not the right size


Home Page


PGU - Phil's pyGame Utilities 0.5 — 7 Oct, 2005

PGU - Phil's pyGame Utilities 0.1.0pre — 24 Jul, 2005

PGU - Phil's pyGame Utilities 0.10.1 — 24 Feb, 2006

PGU - Phil's pyGame Utilities 0.10.2 — 13 Mar, 2006

PGU - Phil's pyGame Utilities 0.3 — 25 Aug, 2005

PGU - Phil's pyGame Utilities 0.9 — 1 Dec, 2005

PGU - Phil's pyGame Utilities 0.1.0 — 4 Aug, 2005

PGU - Phil's pyGame Utilities 0.6 — 24 Oct, 2005

PGU - Phil's pyGame Utilities 0.7 — 19 Nov, 2005

PGU - Phil's pyGame Utilities 0.16 — 16 Mar, 2011

PGU - Phil's pyGame Utilities 0.10.3 — 7 Apr, 2006

PGU - Phil's pyGame Utilities 0.10.6 — 25 Mar, 2007

PGU - Phil's pyGame Utilities 0.10.5 — 1 Sep, 2006

PGU - Phil's pyGame Utilities 0.10 — 11 Feb, 2006

PGU - Phil's pyGame Utilities 0.12.2 — 1 Mar, 2009

PGU - Phil's pyGame Utilities 0.12.1 — 23 Feb, 2009

PGU - Phil's pyGame Utilities 0.14 — 3 Jan, 2011 account Comments

  • Zhangyrmath 2011-06-12 01:20:44

    good!I'll have a try on that

  • Happyfanatic 2012-04-08 19:51:17

    I downloaded PGU to use the iso engine.  The example code makes reference to a set of "tilevid tutorials" They are not included in the download; I couldn't find them on the homepage, or by google search.  Anyone know if these exist anymore?    

    canine828 2016-02-27 22:52:06

    I have them in my PGU download (but it's the 0.18 version)

  • beginner 2012-04-18 01:07:21

    class TestDialog(gui.Dialog):
        def __init__(this):
            title = gui.Label("Some Dialog Box")
            label = gui.Label("The number now is ")
            gui.Dialog.__init__(this, title, label)

    how can i add a global variable inside the label ?? I cannot do something like :

    class TestDialog(gui.Dialog):    def __init__(this):        global s         title = gui.Label("Some Dialog Box")        label = gui.Label("
    The number now is", s)        gui.Dialog.__init__(this, title, label)

    where every time i click a button s increases

    Hghowe 2014-05-09 18:40:52

    You might try label = gui.Label("The number now is {0}".format(s))

    canine828 2016-02-27 22:51:01

    Use str(s) in place of s (you can't combine strings and ints, but you can combine strings and strings), or use hghowe's answer.

  • Magnus D 2012-10-28 21:22:38

    When clicking the close button on the example windows, I do not succeed to close any of them. I am using Python3. Can someone help? I am reffering to the examples that ship with the package itself.

    canine828 2016-02-27 22:48:51

    Pygame is designed for Python 2.7. Install Python 2.7 (or just use it if you have it), and reinstall PGU with Python 2.7!

  • rob00 2013-01-11 03:19:38

    >>>from pgu import gui
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Python32\lib\site-packages\pgu\gui\", line 21, in <module>

    from .container import Container
    File "C:\Python32\lib\site-packges\pgu\gui\", line 57
    except StyleError,e:

    SyntaxError: invalid syntax

    Floriusin 2014-12-26 13:20:46

    Just go into pgu/gui/ and in update() edit "except StyleError,e:" to "except StyleError as e:" and then reinstall

    canine828 2016-02-27 22:47:57

    Wait a minute?! Is that still a bug in version 0.18?

  • fjkdasilva 2013-07-17 16:42:34

    It is not clear how one gets access to values returned from PGU apps in a pygame program. Can anyone help?

  • Bir Bikram Dey 2014-01-01 21:39:51

    I am not sure how to even install this to windows.
    Is it me or pygame is not windows friendly :(

    Beast 2014-05-07 19:52:43

    copy paste cmd.exe into the pgu folder, write the command python install

    canine828 2016-02-27 22:46:05

    Why paste cmd.exe into the pgu folder? Why not just CD to it?

    canine828 2016-02-27 22:45:14

    Pygame is Windows friendly. I have Windows on my school laptop (my parents won't let me put Linux on it), and it works pretty well. Just install Python, open the command prompt, and type C:\Python27\python.exe C:\path\to\the\pge\setup\python\file\ install

    Or add C:\Python27 and C:\Python27\Scripts to your Path, open a command prompt, CD to the folder with your PGE file, and type python install


    Leo Tindall 2015-11-09 22:31:43

    Windows is not windows friendly. Because Windows sucks.

    canine828 2016-02-27 22:45:32

    I completely agree.

  • Anony 2014-09-20 22:25:38

    How to install and use this exactly?

  • JR 2014-10-08 18:19:09

    Is there a way to make the scrollarea widget transparent?

    [ADM]Vox 2014-10-13 18:26:49

    I was asking myself the same question as I really need it to be transparent for my MORPG I'm making... So please someone help us out

  • canine828 2016-02-27 22:42:15

    This is good, but there should be a clean simple Oxygen-ish theme built in. The last thing I want to do is rifle through my filesystem, find out that it's all generated by Qt, and use screenshots to make the gui.

  • Stam Kaly 2016-07-02 14:33:18

    If you get error:

    Traceback (most recent call last):
    File "./", line 84, in <module>
    File "./", line 33, in main
    os.path.walk('data', visit, installdatafiles)
    AttributeError: 'module' object has no attribute 'walk'

    You can delete ".path" in "os.path.walk('data', visit, installdatafiles)"