1#
2# A default slider with a label displaying the current value
3#
4def slider_event_cb(e):
5
6    slider = e.get_target()
7    slider_label.set_text("{:d}%".format(slider.get_value()))
8    slider_label.align_to(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
9
10# Create a slider in the center of the display
11slider = lv.slider(lv.scr_act())
12slider.center()
13slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None)
14
15# Create a label below the slider
16slider_label = lv.label(lv.scr_act())
17slider_label.set_text("0%")
18
19slider_label.align_to(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
20
21