1def back_event_handler(e): 2 obj = e.get_target() 3 if menu.back_btn_is_root(obj): 4 mbox1 = lv.msgbox(lv.scr_act(), "Hello", "Root back btn click.", None, True) 5 mbox1.center() 6 7# Create a menu object 8menu = lv.menu(lv.scr_act()) 9menu.set_mode_root_back_btn(lv.menu.ROOT_BACK_BTN.ENABLED) 10menu.add_event_cb(back_event_handler, lv.EVENT.CLICKED, None) 11menu.set_size(320, 240) 12menu.center() 13 14# Create a sub page 15sub_page = lv.menu_page(menu, None) 16cont = lv.menu_cont(sub_page) 17label = lv.label(cont) 18label.set_text("Hello, I am hiding here") 19 20# Create a main page 21main_page = lv.menu_page(menu, None) 22 23cont = lv.menu_cont(main_page) 24label = lv.label(cont) 25label.set_text("Item 1") 26 27cont = lv.menu_cont(main_page) 28label = lv.label(cont) 29label.set_text("Item 2") 30 31cont = lv.menu_cont(main_page) 32label = lv.label(cont) 33label.set_text("Item 3 (Click me!)") 34menu.set_load_page_event(cont, sub_page) 35 36menu.set_page(main_page)