acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_menu_4.py (1255B)

      1 btn_cnt = 1
      2 
      3 def 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
     19 menu = lv.menu(lv.scr_act())
     20 menu.set_size(320, 240)
     21 menu.center()
     22 
     23 # Create a sub page
     24 sub_page = lv.menu_page(menu, None)
     25 
     26 cont = lv.menu_cont(sub_page)
     27 label = lv.label(cont)
     28 label.set_text("Hello, I am hiding inside the first item")
     29 
     30 # Create a main page
     31 main_page = lv.menu_page(menu, None)
     32 
     33 cont = lv.menu_cont(main_page)
     34 label = lv.label(cont)
     35 label.set_text("Item 1")
     36 menu.set_load_page_event(cont, sub_page)
     37 
     38 menu.set_page(main_page)
     39 
     40 float_btn = lv.btn(lv.scr_act())
     41 float_btn.set_size(50, 50)
     42 float_btn.add_flag(lv.obj.FLAG.FLOATING)
     43 float_btn.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10)
     44 float_btn.add_event_cb(float_btn_event_cb, lv.EVENT.CLICKED, None)
     45 float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0)
     46 float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0)
     47 float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0)