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_bar_3.py (706B)

      1 def set_temp(bar, temp):
      2     bar.set_value(temp, lv.ANIM.ON)
      3 
      4 #
      5 # A temperature meter example
      6 #
      7 
      8 
      9 style_indic = lv.style_t()
     10 
     11 style_indic.init()
     12 style_indic.set_bg_opa(lv.OPA.COVER)
     13 style_indic.set_bg_color(lv.palette_main(lv.PALETTE.RED))
     14 style_indic.set_bg_grad_color(lv.palette_main(lv.PALETTE.BLUE))
     15 style_indic.set_bg_grad_dir(lv.GRAD_DIR.VER)
     16 
     17 bar = lv.bar(lv.scr_act())
     18 bar.add_style(style_indic, lv.PART.INDICATOR)
     19 bar.set_size(20, 200)
     20 bar.center()
     21 bar.set_range(-20, 40)
     22 
     23 a = lv.anim_t()
     24 a.init()
     25 a.set_time(3000)
     26 a.set_playback_time(3000)
     27 a.set_var(bar)
     28 a.set_values(-20, 40)
     29 a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
     30 a.set_custom_exec_cb(lambda a, val: set_temp(bar,val))
     31 lv.anim_t.start(a)
     32