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_event_1.py (554B)
1 class Event_1(): 2 def __init__(self): 3 self.cnt = 1 4 # 5 # Add click event to a button 6 # 7 8 btn = lv.btn(lv.scr_act()) 9 btn.set_size(100, 50) 10 btn.center() 11 btn.add_event_cb(self.event_cb, lv.EVENT.CLICKED, None) 12 13 label = lv.label(btn) 14 label.set_text("Click me!") 15 label.center() 16 17 def event_cb(self,e): 18 print("Clicked") 19 20 btn = e.get_target() 21 label = btn.get_child(0) 22 label.set_text(str(self.cnt)) 23 self.cnt += 1 24 25 evt1 = Event_1()