ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## pyautogui ### 图块区域region的表示 下面的函数可以返回图片所在区域的坐标: ``` pos = pyautogui.locateOnScreen(step['img'], confidence=step['confidence'], region=region) ``` 返回坐标示例: ``` Box(left=893, top=676, width=140, height=38) ``` 该坐标表达的含义如下图: ![](https://img.kancloud.cn/15/95/15959d44170a62a18c34e7d6635a0011_414x245.png) > pyautogui中,region(left,top,width,height)在屏幕上的含义,也是这样的。 ### 坐标point 根据location可以使用center函数获取point。 ``` >>> import pyautogui >>> button7location = pyautogui.locateOnScreen('calc7key.png') >>> button7location Box(left=1416, top=562, width=50, height=41) >>> button7point = pyautogui.center(button7location) >>> button7point Point(x=1441, y=582) ``` ## 缺点 1. 对扩展屏支持不好;比如:扩展屏的范围用region表示为:(-1920,0,1920,1080),截屏结果是全黑色的。 2. pyautogui.write(text)函数中的text字符不支持中文。