Skip to content

Latest commit

 

History

History
187 lines (123 loc) · 5.71 KB

gallery.rst

File metadata and controls

187 lines (123 loc) · 5.71 KB

Gallery / Examples

Several examples are provided with the :pypygame_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.

Game selector example

A simple game selector

Source: examples/game_selector.py

Multiple input example

This example features all widgets available on pygame-menu

Source: examples/multi_input.py

Scroll menu example

Since v3, menu supports scrolls

Source: examples/scroll_menu.py

Simple example

A basic button menu

Source: examples/simple.py

Timer clock example

Timer clock

Source: examples/timer_clock.py

Window resize example

Reizable window example

Source: examples/window_resize.py

Other - Calculator (Decoration, Events, OOP, Frames)

Calculator

Source: examples/other/calculator.py

Other - Dynamic button append

Dynamic button append

Source: examples/other/dynamic_button_append.py

Other - Dynamic widget update (OOP style)

Dynamic widget update in object oriented programming style

Source: examples/other/dynamic_widget_update.py

Other - Image background

Image background

Source: examples/other/image_background.py

Other - Maze Pathfinder (GUI)

Maze App

Source: examples/other/maze.py

Other - Solar System (OOP, UI, Advanced, Decorations)

Beautiful solar system

Source: examples/other/ui_solar_system.py

Other - Widget positioning (OOP, UI, Advanced, Decorations)

Set custom positions to each widget

Source: examples/other/widget_positioning.py