PyAutoGUI
=========
PyAutoGUI is a cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
`pip install pyautogui`
Full documentation available at https://pyautogui.readthedocs.org
Simplified Chinese documentation(简体中文版文档) available at https://muxuezi.github.io/posts/doc-pyautogui.html
Source code available at https://github.com/asweigart/pyautogui
Dependencies
============
If you are installing PyAutoGUI from PyPI using pip:
Windows has no dependencies. The Win32 extensions do not need to be installed.
OS X needs the pyobjc-core and pyobjc module installed (in that order).
Linux needs the python3-xlib (or python-xlib for Python 2) module installed.
Pillow needs to be installed, and on Linux you may need to install additional libraries to make sure Pillow's PNG/JPEG works correctly. See:
https://stackoverflow.com/questions/7648200/pip-install-pil-e-tickets-1-no-jpeg-png-support
http://ubuntuforums.org/showthread.php?t=1751455
If you want to do development and contribute to PyAutoGUI, you will need to install these modules from PyPI:
* pyscreeze
* pymsgbox
* pytweening
Example Usage
=============
Keyboard and Mouse Control
--------------------------
```python
>>> import pyautogui
>>> screenWidth, screenHeight = pyautogui.size()
>>> currentMouseX, currentMouseY = pyautogui.position()
>>> pyautogui.moveTo(100, 150)
>>> pyautogui.click()
>>> pyautogui.moveRel(None, 10) # move mouse 10 pixels down
>>> pyautogui.doubleClick()
>>> pyautogui.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad) # use tweening/easing function to move mouse over 2 seconds.
>>> pyautogui.typewrite('Hello world!', interval=0.25) # type with quarter-second pause in between each key
>>> pyautogui.press('esc')
>>> pyautogui.keyDown('shift')
>>> pyautogui.typewrite(['left', 'left', 'left', 'left', 'left', 'left'])
>>> pyautogui.keyUp('shift')
>>> pyautogui.hotkey('ctrl', 'c')
```
Display Message Boxes
---------------------
```python
>>> import pyautogui
>>> pyautogui.alert('This is an alert box.')
'OK'
>>> pyautogui.confirm('Shall I proceed?')
'Cancel'
>>> pyautogui.confirm('Enter option.', buttons=['A', 'B', 'C'])
'B'
>>> pyautogui.prompt('What is your name?')
'Al'
>>> pyautogui.password('Enter password (text will be hidden)')
'swordfish'
```
Screenshot Functions
--------------------
(PyAutoGUI uses Pillow for image-related features.)
```python
>>> import pyautogui
>>> im1 = pyautogui.screenshot()
>>> im1.save('my_screenshot.png')
>>> im2 = pyautogui.screenshot('my_screenshot2.png')
```
You can also locate where an image is on the screen:
```python
>>> import pyautogui
>>> button7location = pyautogui.locateOnScreen('button.png') # returns (left, top, width, height) of matching region
>>> button7location
(1416, 562, 50, 41)
>>> buttonx, buttony = pyautogui.center(button7location)
>>> buttonx, buttony
(1441, 582)
>>> pyautogui.click(buttonx, buttony) # clicks the center of where the button was found
```
The locateCenterOnScreen() function returns the center of this match region:
```python
>>> import pyautogui
>>> buttonx, buttony = pyautogui.locateCenterOnScreen('button.png') # returns (x, y) of matching region
>>> buttonx, buttony
(1441, 582)
>>> pyautogui.click(buttonx, buttony) # clicks the center of where the button was found
```
onnx
- 粉丝: 1w+
- 资源: 5626
最新资源
- 汇编语言分支结构实验:实现大小写字母转换及其实现方法
- markdown编辑器,使用electron开发
- 汇编语言中循环结构的设计实现及其应用-通过具体实验掌握数据块传送与循环指令应用
- 某米扫地机 大厂程序源码 STM32端代码能实现延边避障防跌 落充电等功能 适合需要学习项目与代码规范的工程师 硬件驱动包含 陀螺仪姿态传感器bmi160、电源管理bq24733等 软件驱动包
- 汇编语言中的子程序设计:实现小写字母转大写的技术详解与实践
- matlab Golay码编码译码
- 自动驾驶车道保持LKA,基于LQR算法,carsim与simulink联合仿真,包括说明书及LQR的推导过程(每一步怎么做的)
- 利用BES秃鹰优化算法优化LSSVM做多特征变量输入,单个因变量输出的拟合预测模型 程序语言为matlab 直接替excel数据就可以用
- PMSM永磁同步电机滑模控制的直接转矩控制改进算法仿真模型,在传统算法上结合滑模控制算法加以改进,基于matlab simulink搭建,以供参考学习
- 图像增强技术中自动色彩增强(ACE)及其快速实现的方法与应用研究
- 带负载转矩前馈补偿的永磁同步电机无感FOC 1.采用龙伯格负载转矩观测器,可快速准确观测到负载转矩; 2.将观测到的负载转矩用作前馈补偿,可提高系统抗负载扰动能力; 提供算法对应的参考文献和仿真模型
- PMSM永磁同步电机控制类仿真 三相永磁同步电机模型 1、直接转矩控制DTC 2、矢量控制FOC 3、无位置控制 4、滑膜控制 #Matlab simulink
- Web前端大作业-个人网页HTML+CSS+JavaScript(高分项目)
- LocalColorCorrection-master.zip
- matlab代码 布谷鸟优化算法CS原代码, 包含23个基准测试函数,都可运行 可用于后续改进和对比, 代码百分百可运行
- 汽车电子网络安全(信息安全)HSM技术资料分享及项目开发 芯片型号:英飞凌 支持算法:RSA,AES,签名生成及验证,CMAC生成及验证等 支持功能:安全服务,SecureBoot,HsmBootl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈