1btn_cnt = 1 2 3def float_btn_event_cb(e): 4 global btn_cnt 5 btn_cnt += 1 6 7 sub_page = lv.menu_page(menu, None) 8 9 cont = lv.menu_cont(sub_page) 10 label = lv.label(cont) 11 label.set_text("Hello, I am hiding inside {:d}".format(btn_cnt)) 12 13 cont = lv.menu_cont(main_page) 14 label = lv.label(cont) 15 label.set_text("Item {:d}".format(btn_cnt)) 16 menu.set_load_page_event(cont, sub_page) 17 18# Create a menu object 19menu = lv.menu(lv.scr_act()) 20menu.set_size(320, 240) 21menu.center() 22 23# Create a sub page 24sub_page = lv.menu_page(menu, None) 25 26cont = lv.menu_cont(sub_page) 27label = lv.label(cont) 28label.set_text("Hello, I am hiding inside the first item") 29 30# Create a main page 31main_page = lv.menu_page(menu, None) 32 33cont = lv.menu_cont(main_page) 34label = lv.label(cont) 35label.set_text("Item 1") 36menu.set_load_page_event(cont, sub_page) 37 38menu.set_page(main_page) 39 40float_btn = lv.btn(lv.scr_act()) 41float_btn.set_size(50, 50) 42float_btn.add_flag(lv.obj.FLAG.FLOATING) 43float_btn.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10) 44float_btn.add_event_cb(float_btn_event_cb, lv.EVENT.CLICKED, None) 45float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0) 46float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0) 47float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0)