Simple menu library for CircuitPython devices, designed for Adafruit RP2040 macropad.
Project description
Fruity Menu
Build a simple UI in CircuitPython. Designed for the Adafruit RP2040 Macropad, but usable with any displayio.Display
.
The Menu
The most important class is the Menu
. Instantiate one to get started, then use helper methods
to add options and submenus.
Available menu options
ActionButton
: Invoke the given function with optional argumentsSubmenuButton
: Open another menu as a nested submenuValueButton
: Adjust the value of a boolean or numeric variable
menu = Menu(display, title='Main Menu')
menu.add_action_button('Shut down', action=myobj.dafunc)
sub_settings = menu.create_menu('Settings')
sub_settings.add_value_button('Screen brightness', screen.brightness, update_screen_brightness)
menu.add_submenu_button('Open Settings...', sub_settings)
In the above example, a Menu is created and from that menu, buttons and submenus are added.
To complete the implementation of this menu, you would need to provide functions myobj.dafunc
and update_screen_brightness
as well as the screen.brightness
object used in the Value button.
These fields presumably come from the code you are using the menu for, so use as you see fit.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for fruity_display_menu-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ff87d021c309f29ca57e3273768fa38b80f0bf1139d7dd94ed68c5134cf1487 |
|
MD5 | 120608c9d5715e38b7a2df657e6f898c |
|
BLAKE2b-256 | c29bbb2acc3e147c724a57dd955d6a41aa86a96d5fd37ef84f846091ff9734b2 |