1def slider_event_cb(evt): 2 slider = evt.get_target() 3 4 # Refresh the text 5 label.set_text(str(slider.get_value())) 6 7# 8# Create a slider and write its value on a label. 9# 10 11# Create a slider in the center of the display 12slider = lv.slider(lv.scr_act()) 13slider.set_width(200) # Set the width 14slider.center() # Align to the center of the parent (screen) 15slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function 16 17# Create a label above the slider 18label = lv.label(lv.scr_act()) 19label.set_text("0") 20label.align_to(slider, lv.ALIGN.OUT_TOP_MID, 0, -15) # Align below the slider 21 22 23