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_arc_2.py (669B)

      1 #
      2 # An `lv_timer` to call periodically to set the angles of the arc
      3 #
      4 class ArcLoader():
      5     def __init__(self):
      6         self.a = 270
      7 
      8     def arc_loader_cb(self,tim,arc):
      9         # print(tim,arc)
     10         self.a += 5
     11 
     12         arc.set_end_angle(self.a)
     13 
     14         if self.a >= 270 + 360:
     15             tim._del()
     16 
     17 
     18 #
     19 # Create an arc which acts as a loader.
     20 #
     21 
     22 # Create an Arc
     23 arc = lv.arc(lv.scr_act())
     24 arc.set_bg_angles(0, 360)
     25 arc.set_angles(270, 270)
     26 arc.center()
     27 
     28 # create the loader
     29 arc_loader = ArcLoader()
     30 
     31 # Create an `lv_timer` to update the arc.
     32 
     33 timer = lv.timer_create_basic()
     34 timer.set_period(20)
     35 timer.set_cb(lambda src: arc_loader.arc_loader_cb(timer,arc))
     36 
     37