pygame-menu

Menu for pygame, simple, lightweight and easy to use

This project is maintained by ppizarror

Pygame Menu

Pygame Menu

Menu for pygame, simple, lightweight and easy to use

@ppizarror License GPL v3 Python 2.7


Python library that can create a Menu on Pygame, supports:

  1. Textual menus
  2. Textual menus + buttons
  3. Lists of values (that i called Selectors) that can trigger functions when pressing Return or changing the value
  4. Button menus

Examples:

Normal Button menu

Text menu

Small submenu

Import

Import of this library is similar as pygame:

import pygameMenu                # This imports classes and other things
from pygameMenu.locals import *  # Import constants (like actions)

Obviously you need Pygame to run this.

Usage

Creating menus

Add options and entries to Menus

Menu and TextMenu have the next functions:

Supported events are the same:

Event Description
PYGAME_MENU_BACK Go back on menu
PYGAME_MENU_CLOSE Close menu
PYGAME_MENU_EXIT Close application
PYGAME_MENU_DISABLE_CLOSE Disable close menu
PYGAME_MENU_RESET Reset menu

This events are imported on from pygameMenu.locals import * line.

Using fonts

Also this library has some fonts to use, to load a font run this code:

import pygameMenu

fontdir = pygameMenu.fonts.FONT_NAME

Avaiable fonts (FONT_NAME): 8BIT, BEBAS, FRANCHISE, MUNRO and NEVIS.

Configurations

Default parameters of Menu and TextMenu are stored on the following files:

File Description
config_controls.py Configure default key-events of Menus
config_menu.py Configure default parameter of Menu class
config_textmenu.py Configure default parameter of TextMenu class

License

This project is licensed under GPLv3 [https://www.gnu.org/licenses/gpl-3.0.html]

Author

Pablo Pizarro R. | 2017