예제 #1
0
device.tap([(400, 600)])
# multi-tap
device.tap([(400, 400), (600, 600)])
# set the pressure, default == 100
device.tap([(400, 600)], pressure=50)

# long-time-tap
# for long-click, you should control time delay by yourself
# because minitouch return nothing when actions done
# we will never know the time when it finished
device.tap([(400, 600)], duration=1000)
time.sleep(1)


# swipe
device.swipe([(100, 100), (500, 500)])
# of course, with duration and pressure
device.swipe([(100, 100), (400, 400), (200, 400)], duration=500, pressure=59)

# stop minitouch
# when it was stopped, minitouch can do nothing for device, including release.
device.stop()


# In another way, you needn't consider about device's life-cycle.
# context manager will handle it
with safe_device(_DEVICE_ID) as device:
    # single-tap
    device.tap([(400, 600)])
    # multi-tap
    device.tap([(400, 400), (600, 600)])
예제 #2
0
# single-tap
device.tap([(400, 600)])
# multi-tap
device.tap([(400, 400), (600, 600)])
# set the pressure, default == 100
device.tap([(400, 600)], pressure=50)

# long-time-tap
device.tap([(400, 600)], duration=2000)

# and no up at the end. you can continue your actions after that. default to false
device.tap([(400, 600)], duration=2000, no_up=True)

# swipe
device.swipe([(100, 100), (500, 500)])
# of course, with duration and pressure
device.swipe([(100, 100), (400, 400), (200, 400)], duration=500, pressure=50)

# and no down at the beginning or no up at the end.
# you can apply a special action before swipe, to build a complex action.
device.tap([(400, 600)], duration=2000, no_up=True)
device.swipe(
    [(400, 600), (400, 400), (200, 400)],
    duration=500,
    pressure=50,
    no_down=True,
    no_up=True,
)
device.swipe([(200, 400), (400, 400), (400, 600)],
             duration=500,