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

test.py (1639B)

      1 #!/opt/bin/lv_micropython -i
      2 import lvgl as lv
      3 import display_driver
      4 def event_handler(e):
      5     code = e.get_code()
      6     obj = e.get_target()
      7     if code == lv.EVENT.CLICKED:
      8             print("Clicked: list1." + list1.get_btn_text(obj))
      9 
     10 # Create a list
     11 list1 = lv.list(lv.scr_act())
     12 list1.set_size(180, 220)
     13 list1.center()
     14 
     15 # Add buttons to the list
     16 list1.add_text("File")
     17 btn_new = list1.add_btn(lv.SYMBOL.FILE, "New")
     18 btn_new.add_event_cb(event_handler,lv.EVENT.ALL, None)
     19 btn_open = list1.add_btn(lv.SYMBOL.DIRECTORY, "Open")
     20 btn_open.add_event_cb(event_handler,lv.EVENT.ALL, None)
     21 btn_save = list1.add_btn(lv.SYMBOL.SAVE, "Save")
     22 btn_save.add_event_cb(event_handler,lv.EVENT.ALL, None)
     23 btn_delete = list1.add_btn(lv.SYMBOL.CLOSE, "Delete")
     24 btn_delete.add_event_cb(event_handler,lv.EVENT.ALL, None)
     25 btn_edit = list1.add_btn(lv.SYMBOL.EDIT, "Edit")
     26 btn_edit.add_event_cb(event_handler,lv.EVENT.ALL, None)
     27 
     28 list1.add_text("Connectivity")
     29 btn_bluetooth = list1.add_btn(lv.SYMBOL.BLUETOOTH, "Bluetooth")
     30 btn_bluetooth.add_event_cb(event_handler,lv.EVENT.ALL, None)
     31 btn_navig = list1.add_btn(lv.SYMBOL.GPS, "Navigation")
     32 btn_navig.add_event_cb(event_handler,lv.EVENT.ALL, None)
     33 btn_USB = list1.add_btn(lv.SYMBOL.USB, "USB")
     34 btn_USB.add_event_cb(event_handler,lv.EVENT.ALL, None)
     35 btn_battery = list1.add_btn(lv.SYMBOL.BATTERY_FULL, "Battery")
     36 btn_battery.add_event_cb(event_handler,lv.EVENT.ALL, None)
     37 
     38 list1.add_text("Exit")
     39 btn_apply = list1.add_btn(lv.SYMBOL.OK, "Apply")
     40 btn_apply.add_event_cb(event_handler,lv.EVENT.ALL, None)
     41 btn_close = list1.add_btn(lv.SYMBOL.CLOSE, "Close")
     42 btn_close.add_event_cb(event_handler,lv.EVENT.ALL, None)
     43