Appearance
touch
touch.click()
Tap the screen at the given coordinates.
python
touch.click(x: int, y: int, id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | int | X coordinate. | |
| y | int | Y coordinate. | |
| id | int | 1 | Finger ID. |
Return
None.
Example
python
import time
from catscript import touch
if __name__ == "__main__":
touch.click(100, 100)touch.long_press()
Press and hold a point on the screen.
python
touch.long_press(x: int, y: int, duration: int = 500, id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | int | X coordinate. | |
| y | int | Y coordinate. | |
| duration | int | 500 | Hold duration in milliseconds. |
| id | int | 1 | Finger ID. |
Return
None.
Raises ValueError if duration <= 0 or id < 0.
Example
python
from catscript import touch
if __name__ == "__main__":
touch.long_press(300, 800, duration=800)touch.swipe()
Swipe from one point to another.
python
touch.swipe(x1: int, y1: int, x2: int, y2: int, duration: int = 300, id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x1 | int | Start X coordinate. | |
| y1 | int | Start Y coordinate. | |
| x2 | int | End X coordinate. | |
| y2 | int | End Y coordinate. | |
| duration | int | 300 | Swipe duration in milliseconds. |
| id | int | 1 | Finger ID. |
Return
None.
Raises ValueError if duration <= 0 or id < 0.
Example
python
from catscript import touch
if __name__ == "__main__":
touch.swipe(500, 2000, 500, 600, duration=300)touch.down()
Touch down at the given coordinates.
python
touch.down(x: int, y: int, id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | int | X coordinate. | |
| y | int | Y coordinate. | |
| id | int | 1 | Finger ID. |
Return
None.
Example
python
import time
from catscript import touch
if __name__ == "__main__":
touch.down(100, 100)
time.sleep(0.1)
touch.up()touch.move()
Move an active touch.
python
touch.move(x: int, y: int, id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | int | X coordinate. | |
| y | int | Y coordinate. | |
| id | int | 1 | Finger ID. |
Return
None.
Example
python
import time
from catscript import touch
def slide_x(start, end, step, y):
xs = range(start + step, end, step)
touch.down(start, y)
time.sleep(0.01)
for x in xs:
touch.move(x, y)
time.sleep(0.01)
touch.up()
if __name__ == "__main__":
slide_x(100, 500, 20, 500)touch.up()
Release a touch.
python
touch.up(id: int = 1) -> NoneArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | int | 1 | Finger id. |
Return
None.
Example
python
import time
from catscript import touch
if __name__ == "__main__":
touch.down(100, 100)
time.sleep(0.1)
touch.up()