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_obj_2.py (426B)

      1 def drag_event_handler(e):
      2 
      3     obj = e.get_target()
      4 
      5     indev = lv.indev_get_act()
      6 
      7     vect = lv.point_t()
      8     indev.get_vect(vect)
      9     x = obj.get_x() + vect.x
     10     y = obj.get_y() + vect.y
     11     obj.set_pos(x, y)
     12 
     13 
     14 #
     15 # Make an object dragable.
     16 #
     17 
     18 obj = lv.obj(lv.scr_act())
     19 obj.set_size(150, 100)
     20 obj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None)
     21 
     22 label = lv.label(obj)
     23 label.set_text("Drag me")
     24 label.center()
     25