为了账号安全,请及时绑定邮箱和手机立即绑定

Python-pyautogui模块

标签:
Python

1、安装pyautogui模块
C:\Users\lenovo>pip install pyautogui
Collecting pyautogui
  Downloading PyAutoGUI-0.9.36.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 18kB/s
Collecting pymsgbox (from pyautogui)
  Downloading PyMsgBox-1.0.6.zip
Collecting PyTweening>=1.0.1 (from pyautogui)
  Downloading PyTweening-1.0.3.zip
Collecting Pillow (from pyautogui)
  Downloading Pillow-5.0.0-cp36-cp36m-win_amd64.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 57kB/s
Collecting pyscreeze (from pyautogui)
  Downloading PyScreeze-0.1.14.tar.gz
Installing collected packages: pymsgbox, PyTweening, Pillow, pyscreeze, pyautogui
  Running setup.py install for pymsgbox ... done
  Running setup.py install for PyTweening ... done
  Running setup.py install for pyscreeze ... done
  Running setup.py install for pyautogui ... done
Successfully installed Pillow-5.0.0 PyTweening-1.0.3 pyautogui-0.9.36 pymsgbox-1.0.6 pyscreeze-0.1.14


2、eclipse + Pydev 使用pyautogui模块
按固定坐标移动鼠标
from pyautogui import moveTo
for i in range(10):
    moveTo(100,100,duration=0.25)
    moveTo(200,100,duration=0.25)
    moveTo(200,200,duration=0.25)
    moveTo(100,200,duration=0.25)
移动当前鼠标
from pyautogui import moveRel
for i in range(10):
    moveRel(100,0,duration=0.25)
    moveRel(0,100,duration=0.25)
    moveRel(-100,0,duration=0.25)
    moveRel(0,-100,duration=0.25)
获取当前鼠标位置
>>> import pyautogui
>>> pyautogui.position()
(673, 527)
>>> pyautogui.position()
(639, 654)
>>> pyautogui.position()
(1276, 745) 
  
  
 

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消