Several examples are provided with the :py:mod:`pygame_menu` library. To run the examples, simply execute these commands in a terminal:
$> python3 -m pygame_menu.examples.game_selector
$> python3 -m pygame_menu.examples.multi_input
$> python3 -m pygame_menu.examples.scroll_menu
$> python3 -m pygame_menu.examples.simple
$> python3 -m pygame_menu.examples.timer_clock
$> python3 -m pygame_menu.examples.window_resize
Other examples that show specific use cases of the menu are also provided:
$> python3 -m pygame_menu.examples.other.calculator
$> python3 -m pygame_menu.examples.other.dynamic_button_append
$> python3 -m pygame_menu.examples.other.dynamic_widget_update
$> python3 -m pygame_menu.examples.other.image_background
$> python3 -m pygame_menu.examples.other.maze
$> python3 -m pygame_menu.examples.other.scrollbar
$> python3 -m pygame_menu.examples.other.scrollbar_area
$> python3 -m pygame_menu.examples.other.ui_solar_system
$> python3 -m pygame_menu.examples.other.widget_positioning
Them can also be imported as follows:
from pygame_menu.examples.example import main
main()
Example sources can also be found in the Github repo. Also, check out widget-specific examples in the Adding Widgets documentation page.
Source: examples/game_selector.py
Source: examples/multi_input.py
Source: examples/scroll_menu.py
Source: examples/simple.py
Source: examples/timer_clock.py
Source: examples/window_resize.py
Source: examples/other/calculator.py
Source: examples/other/dynamic_button_append.py
Source: examples/other/dynamic_widget_update.py
Source: examples/other/image_background.py
Source: examples/other/maze.py
Source: examples/other/ui_solar_system.py