notes/snippet/python/autolearn.py

32 lines
591 B
Python

#coding=utf-8
"""
required: python + pyautogui
pip install pyautogui
"""
import random
import time
import pyautogui
def learn():
start_x = 0
stop_x = 1560
pos_x = start_x
pos_y = 967
# pyautogui.moveTo()
while (pos_x <= stop_x):
pyautogui.moveTo(pos_x, pos_y)
pyautogui.click()
time.sleep(random.random() + 1.1)
pos_x = pos_x + 10
# pyautogui.move()
print('Congradulations! You have finished this lesson!')
if __name__ == '__main__':
try:
learn()
except KeyboardInterrupt:
print('Stopped')