refactor(btn, img): rename btn to button and img to image

This commit is contained in:
Gabor Kiss-Vamosi
2023-09-14 20:12:31 +02:00
parent e91786ce49
commit 09c12d0f9c
366 changed files with 3271 additions and 3222 deletions

View File

@@ -5,23 +5,23 @@ class CounterBtn():
# Create a button with a label and react on click event.
#
btn = lv.btn(lv.scr_act()) # Add a button the current screen
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(self.btn_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button
label = lv.label(btn) # Add a label to the button
button = lv.button(lv.scr_act()) # Add a button the current screen
button.set_pos(10, 10) # Set its position
button.set_size(120, 50) # Set its size
button.align(lv.ALIGN.CENTER,0,0)
button.add_event(self.button_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button
label = lv.label(button) # Add a label to the button
label.set_text("Button") # Set the labels text
label.center()
def btn_event_cb(self,e):
def button_event_cb(self,e):
code = e.get_code()
btn = e.get_target_obj()
button = e.get_target_obj()
if code == lv.EVENT.CLICKED:
self.cnt += 1
# Get the first child of the button which is the label and change its text
label = btn.get_child(0)
label = button.get_child(0)
label.set_text("Button: " + str(self.cnt))