mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
ad947d3085
* add menu widget * Update lv_example_widgets.h * fix errors * Update lv_menu.c * try to fix errors * micropython * Fix colons * Simplify and optimise * Refactor * Update lv_example_menu_3.c * Update lv_example_menu_3.c * Add simple micropython examples * Improvements * Automatically set clickable flags * Custom header example * Include example * Refactor again * Fix error * Fix error * Add back micropython example * Hide back btn by default * Add config * Fix spacing * Fix spacing * Docs * Update lv_theme_default.c * Remove shaded text * Improve clarity * Create index.rst * Update custom header example * Change lv_menu_set_mode_sidebar to lv_menu_set_sidebar_page * Fix unused variable * Added ability to set title to page * Flex * Simplify sidebar check * Rename mode and update header btn * Run lv_conf_internal_gen.py * Run code-format.sh * Add contributors * Micropython example 3 * Micropython example 4 * Improve docs
43 lines
1021 B
Python
43 lines
1021 B
Python
# Create a menu object
|
|
menu = lv.menu(lv.scr_act())
|
|
menu.set_size(320, 240)
|
|
menu.center()
|
|
|
|
# Create sub pages
|
|
sub_page_1 = lv.menu_page(menu, "Page 1")
|
|
|
|
cont = lv.menu_cont(sub_page_1)
|
|
label = lv.label(cont)
|
|
label.set_text("Hello, I am hiding here")
|
|
|
|
sub_page_2 = lv.menu_page(menu, "Page 2")
|
|
|
|
cont = lv.menu_cont(sub_page_2)
|
|
label = lv.label(cont)
|
|
label.set_text("Hello, I am hiding here")
|
|
|
|
sub_page_3 = lv.menu_page(menu, "Page 3")
|
|
|
|
cont = lv.menu_cont(sub_page_3)
|
|
label = lv.label(cont)
|
|
label.set_text("Hello, I am hiding here")
|
|
|
|
# Create a main page
|
|
main_page = lv.menu_page(menu, None)
|
|
|
|
cont = lv.menu_cont(main_page)
|
|
label = lv.label(cont)
|
|
label.set_text("Item 1 (Click me!)")
|
|
menu.set_load_page_event(cont, sub_page_1)
|
|
|
|
cont = lv.menu_cont(main_page)
|
|
label = lv.label(cont)
|
|
label.set_text("Item 2 (Click me!)")
|
|
menu.set_load_page_event(cont, sub_page_2)
|
|
|
|
cont = lv.menu_cont(main_page)
|
|
label = lv.label(cont)
|
|
label.set_text("Item 3 (Click me!)")
|
|
menu.set_load_page_event(cont, sub_page_3)
|
|
|
|
menu.set_page(main_page) |