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_dropdown_1.py (639B)
1 def event_handler(e): 2 code = e.get_code() 3 obj = e.get_target() 4 if code == lv.EVENT.VALUE_CHANGED: 5 option = " "*10 # should be large enough to store the option 6 obj.get_selected_str(option, len(option)) 7 # .strip() removes trailing spaces 8 print("Option: \"%s\"" % option.strip()) 9 10 # Create a normal drop down list 11 dd = lv.dropdown(lv.scr_act()) 12 dd.set_options("\n".join([ 13 "Apple", 14 "Banana", 15 "Orange", 16 "Cherry", 17 "Grape", 18 "Raspberry", 19 "Melon", 20 "Orange", 21 "Lemon", 22 "Nuts"])) 23 24 dd.align(lv.ALIGN.TOP_MID, 0, 20) 25 dd.add_event_cb(event_handler, lv.EVENT.ALL, None) 26