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