|
pygame is
pygame.org is
|
Simple Pygame Menu
Simple Pygame Menu - 1.2Gummbum (gummbum)Tags:DescriptionA low-fuss, infinitely nested popup menu for pygame. It don't get no simpler den dis.
Inspired by SimpleMenu for pyglet.
I couldn't find one of these for pygame, so I wrote one and decided to make it reusable. Hope you enjoy.
Gumm
menu_data = (
'Main',
'Item 0',
'Item 1',
(
'Things',
'Item 0',
'Item 1',
'Item 2',
(
'More Things',
'Item 0',
'Item 1',
),
),
'Quit',
)
PopupMenu(menu_data)
for e in pygame.event.get():
if e.type == USEREVENT and e.code == 'MENU':
print 'menu event: %s.%d: %s' % (e.name,e.item_id,e.text)
if (e.name,e.text) == ('Main','Quit'):
quit()
ChangesAdded class NonBlockingPopupMenu to simplify use.
Added exception handlers around "import data" and font initialization. If the data.py cannot be imported, or the preferred font cannot be loaded from file, the default system font is quietly used. This supports less restrictive inclusion in other libraries.
Added pos=None parameter to constructors to provide the option of explicit positioning.
Added class SubmenuLabel for strong-typing of submenu text in menus. This allows PopupMenu.handle_events() to accurately detect submenus as opposed to the previous trick endswith('...'). It also lifts the restriction implied by depending on endswith('...'), so coders are free to put any text they want in labels without side-effects.
Tweaked demos.
LinksScreenshot click to view original size
Releases
Pygame.org account CommentsIf you wish to leave a comment with your pygame.org account, please sign in first.
|
| spotlight |
|
|
|
| our projects |
|
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
|
|
|
| recent releases |
|
May 19, 2013
May 18, 2013
May 17, 2013
May 16, 2013
May 15, 2013
May 11, 2013
May 8, 2013
Apr 26, 2013
Apr 24, 2013
Apr 23, 2013
... more!
|
|