1def 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
18obj = lv.obj(lv.scr_act())
19obj.set_size(150, 100)
20obj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None)
21
22label = lv.label(obj)
23label.set_text("Drag me")
24label.center()
25
26