arch(driver): new driver architecture with new color format support
This commit is contained in:
@@ -7,4 +7,3 @@ label = lv.label(lv.scr_act())
|
||||
label.set_text("Hello world")
|
||||
label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
|
||||
label.align(lv.ALIGN.CENTER, 0, 0)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void lv_example_get_started_2(void)
|
||||
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
|
||||
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
|
||||
lv_obj_set_size(btn, 120, 50); /*Set its size*/
|
||||
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
|
||||
lv_obj_add_event(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
|
||||
|
||||
lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
|
||||
lv_label_set_text(label, "Button"); /*Set the labels text*/
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -46,6 +46,11 @@ label = lv.label(btn) # Add a label to the button
|
||||
label.set_text("Button") # Set the labels text
|
||||
label.center()
|
||||
|
||||
# Create a slider in the center of the display
|
||||
slider = lv.slider(lv.scr_act())
|
||||
slider.set_width(200) # Set the width
|
||||
slider.center() # Align to the center of the parent (screen)
|
||||
|
||||
# Create another button and use the red style too
|
||||
btn2 = lv.btn(lv.scr_act())
|
||||
btn2.remove_style_all() # Remove the styles coming from the theme
|
||||
|
||||
@@ -21,7 +21,7 @@ void lv_example_get_started_4(void)
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act());
|
||||
lv_obj_set_width(slider, 200); /*Set the width*/
|
||||
lv_obj_center(slider); /*Align to the center of the parent (screen)*/
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/
|
||||
lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/
|
||||
|
||||
/*Create a label above the slider*/
|
||||
label = lv_label_create(lv_scr_act());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
def slider_event_cb(evt):
|
||||
slider = evt.get_target()
|
||||
def slider_event_cb(e):
|
||||
slider = e.get_target_obj()
|
||||
|
||||
# Refresh the text
|
||||
label.set_text(str(slider.get_value()))
|
||||
@@ -12,7 +12,7 @@ def slider_event_cb(evt):
|
||||
slider = lv.slider(lv.scr_act())
|
||||
slider.set_width(200) # Set the width
|
||||
slider.center() # Align to the center of the parent (screen)
|
||||
slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function
|
||||
slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function
|
||||
|
||||
# Create a label above the slider
|
||||
label = lv.label(lv.scr_act())
|
||||
|
||||
Reference in New Issue
Block a user