first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions
25
libraries/lvgl/examples/widgets/obj/lv_example_obj_2.py
Normal file
25
libraries/lvgl/examples/widgets/obj/lv_example_obj_2.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
def drag_event_handler(e):
|
||||
|
||||
obj = e.get_target()
|
||||
|
||||
indev = lv.indev_get_act()
|
||||
|
||||
vect = lv.point_t()
|
||||
indev.get_vect(vect)
|
||||
x = obj.get_x() + vect.x
|
||||
y = obj.get_y() + vect.y
|
||||
obj.set_pos(x, y)
|
||||
|
||||
|
||||
#
|
||||
# Make an object dragable.
|
||||
#
|
||||
|
||||
obj = lv.obj(lv.scr_act())
|
||||
obj.set_size(150, 100)
|
||||
obj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None)
|
||||
|
||||
label = lv.label(obj)
|
||||
label.set_text("Drag me")
|
||||
label.center()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue