示例#1
0

from zxtouch.client import zxtouch
from zxtouch.toasttypes import *
import time
from zxtouch.touchtypes import *

device = zxtouch("127.0.0.1")

device.show_toast(TOAST_WARNING, "Touching point (400, 400)", 1.5)
device.touch(TOUCH_DOWN, 1, 400, 400)
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Moving to point (400, 600)", 1.5)
device.touch(TOUCH_MOVE, 1, 400, 600)
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Touch up", 1.5)
device.touch(TOUCH_UP, 1, 400, 600)
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Touching point (100, 100)", 1.5)
device.touch(TOUCH_DOWN, 1, 100, 100)
time.sleep(0.1)
device.touch(TOUCH_UP, 1, 100, 100)
time.sleep(1.4)

device.show_toast(TOAST_WARNING, "Multitouching...Point (300, 300) and (500, 500)", 2.5)
device.touch_with_list([{"type": TOUCH_DOWN, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_DOWN, "finger_index": 2, "x": 500, "y": 500}])
time.sleep(1)
device.touch_with_list([{"type": TOUCH_UP, "finger_index": 1, "x": 300, "y": 300}, {"type": TOUCH_UP, "finger_index": 2, "x": 500, "y": 500}])
示例#2
0
from zxtouch.client import zxtouch
from zxtouch.toasttypes import *
import time

device = zxtouch("192.168.0.14")
device.show_toast(TOAST_MESSAGE, "Opening Notes...", 2)
time.sleep(2)
device.show_toast(TOAST_MESSAGE, "Please select an input field! 3...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Please select an input field! 2...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Please select an input field! 1...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Inserting text...", 1.5)
device.insert_text("This text is generated by zxtouch!")
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Hiding the keyboard...", 1.5)
device.hide_keyboard()
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Move cursor to the left by 3 position", 1.5)
device.move_cursor(-3)
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Delete 3 characters...", 1.5)
device.insert_text("\b\b\b")
time.sleep(1.5)