arch(driver): new driver architecture with new color format support
This commit is contained in:
@@ -9,14 +9,14 @@ class CounterBtn():
|
||||
btn.set_pos(10, 10) # Set its position
|
||||
btn.set_size(120, 50) # Set its size
|
||||
btn.align(lv.ALIGN.CENTER,0,0)
|
||||
btn.add_event_cb(self.btn_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button
|
||||
btn.add_event(self.btn_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button
|
||||
label = lv.label(btn) # Add a label to the button
|
||||
label.set_text("Button") # Set the labels text
|
||||
label.center()
|
||||
|
||||
def btn_event_cb(self,evt):
|
||||
code = evt.get_code()
|
||||
btn = evt.get_target()
|
||||
def btn_event_cb(self,e):
|
||||
code = e.get_code()
|
||||
btn = e.get_target_obj()
|
||||
if code == lv.EVENT.CLICKED:
|
||||
self.cnt += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user