import pyautogui
import time
# 获取屏幕大小
# size = pyautogui.size()
# print(size)
# 获取鼠标坐标
# mouse_pos = pyautogui.position()
# print(mouse_pos)
# 判断该坐标是否在屏幕内
# print(pyautogui.onScreen(100,100))
# --------------------------------------------------------
# 把鼠标移动到(10,10)的位置,周期1秒
# pyautogui.moveTo(10,10,duration=1)
# 把鼠标画面正中间,周期0.5秒
# pyautogui.moveTo(size.width/2,size.height/2,duration=0.5)
# 鼠标相对移动,周期1秒
# pyautogui.moveRel(100,0,duration=1)
# 获取鼠标实时位置
# last_pos = pyautogui.position()
# while True:
# new_pos = pyautogui.position()
# if last_pos != new_pos:
# print(new_pos)
# last_pos = new_pos
# ------------------------------------------------------------
# 系统准备时间
# time.sleep(2)
# 取得帮助菜单的位置
# 使用locateOnScreen接口要安装以下包
# pip install opencv_python -i https://pypi.tuna.tsinghua.edu.cn/simple 该包主要是为了更好的分辨图像
# pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple 该包主要是为了应对图像处理所使用的
# 获取图片坐标
# help_pos = pyautogui.locateOnScreen('help.png',grayscale=True,confidence=.5)
# 获取该坐标的中心点
# goto_pos = pyautogui.center(help_pos)
# 移动鼠标
# pyautogui.moveTo(goto_pos,duration=1)
# 点击鼠标
# pyautogui.click()
# pyautogui.moveRel(0,541,duration=1)
# pyautogui.click()
# --------------------------------------------
# 键盘输入
# time.sleep(3)
# pyautogui.click(button='left')
# pyautogui.typewrite('hello your words',0.1)
# pyautogui.typewrite(['enter','p','e','e'],0.2)
# --------------------------------------------
# 组合键使用
# time.sleep(3)
# 每个动作间隔0.5秒
# pyautogui.PAUSE = 0.5
# pyautogui.press('f5')
# pyautogui.typewrite('\nhello',0.1)
# pyautogui.typewrite('\nhello',0.1)
# pyautogui.typewrite('\nhello',0.1)
# pyautogui.keyDown('ctrl')
# pyautogui.press('a')
# pyautogui.press('c')
# pyautogui.keyUp('ctrl')
# pyautogui.click(600,600)
# pyautogui.hotkey('ctrl', 'v')
Matlab仿真实验室
- 粉丝: 3w+
- 资源: 2402
最新资源
- 基于NDIS 6.x的Filter生成代码
- js-leetcode题解之12-integer-to-roman.js
- js-leetcode题解之11-container-with-most-water.js
- js-leetcode题解之10-regular-expression-matching.js
- js-leetcode题解之9-palindrome-number.js
- js-leetcode题解之8-string-to-integer-(atoi).js
- js-leetcode题解之7-reverse-integer.js
- js-leetcode题解之6-zigzag-conversion.js
- js-leetcode题解之5-longest-palindromic-substring.js
- js-leetcode题解之4-median-of-two-sorted-arrays.js
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈