mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
33 lines
531 B
Python
33 lines
531 B
Python
#!pika
|
|
import pika_lvgl as lv
|
|
from PikaStdLib import MemChecker
|
|
|
|
mem = MemChecker()
|
|
|
|
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)
|
|
mem.now()
|
|
|
|
|
|
#
|
|
# 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()
|
|
|
|
#!pika |