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_2.py (936B)

      1 def 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
      8 menu = lv.menu(lv.scr_act())
      9 menu.set_mode_root_back_btn(lv.menu.ROOT_BACK_BTN.ENABLED)
     10 menu.add_event_cb(back_event_handler, lv.EVENT.CLICKED, None)
     11 menu.set_size(320, 240)
     12 menu.center()
     13 
     14 # Create a sub page
     15 sub_page = lv.menu_page(menu, None)
     16 cont = lv.menu_cont(sub_page)
     17 label = lv.label(cont)
     18 label.set_text("Hello, I am hiding here")
     19 
     20 # Create a main page
     21 main_page = lv.menu_page(menu, None)
     22 
     23 cont = lv.menu_cont(main_page)
     24 label = lv.label(cont)
     25 label.set_text("Item 1")
     26 
     27 cont = lv.menu_cont(main_page)
     28 label = lv.label(cont)
     29 label.set_text("Item 2")
     30 
     31 cont = lv.menu_cont(main_page)
     32 label = lv.label(cont)
     33 label.set_text("Item 3 (Click me!)")
     34 menu.set_load_page_event(cont, sub_page)
     35 
     36 menu.set_page(main_page)