acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_slider_1.py (575B)

      1 #
      2 # A default slider with a label displaying the current value
      3 #
      4 def 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
     11 slider = lv.slider(lv.scr_act())
     12 slider.center()
     13 slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None)
     14 
     15 # Create a label below the slider
     16 slider_label = lv.label(lv.scr_act())
     17 slider_label.set_text("0%")
     18 
     19 slider_label.align_to(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
     20