Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyautogui, time
- print(pyautogui.size())
- print(pyautogui.position())
- w, h = pyautogui.size()
- center, seconds, direction, boundary = (w / 2, h / 2), 5, -1, 200
- pyautogui.moveTo(center)
- print('Robot running... Press Ctrl-C to quit.')
- try:
- i = 1
- while True:
- x, y = pyautogui.position()
- if i > 1:
- direction *= -1
- i = 0
- pyautogui.move(0, boundary * direction, seconds)
- time.sleep(seconds)
- i += 1
- except KeyboardInterrupt:
- print('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement