How to create a drop-down menu in python using the pygame graphic module? (task, there are many colors and you need to choose one from the list)
1 answer
Try to adapt this library to your needs:
http://simple-pygame-menu.googlecode.com/svn/trunk/
Code example:
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() |