当前位置:   article > 正文

Python pyautogui 操作鼠标_pyautogui移动鼠标

pyautogui移动鼠标
import time
import os
import pyautogui

value = True;
try:
    while value:
        x, y = pyautogui.position()
        pos = "鼠标当前位置: {} , {}".format(str(x), str(y))
        print(pos)
        time.sleep(0.2)
        os.system('cls')
except KeyboardInterrupt:
    print("end...")

# 鼠标的绝对位置移动
# pyautogui.moveTo(x=303, y=86, duration=0.5)

# 鼠标的相对位置移动
# time.sleep(2)
# pyautogui.moveRel(xOffset=250, yOffset=0, duration=2)


# 鼠标绝对位置拖拽
# time.sleep(3)
# pyautogui.dragTo(295, 255, 1, button='left')

# 鼠标相对位置拖拽
# time.sleep(3)
# pyautogui.dragRel(xOffset=555, yOffset=0, duration=1)
# time.sleep(1)
# pyautogui.dragRel(xOffset=-500, yOffset=0, duration=1)


# 鼠标的点击
time.sleep(2)
# pyautogui.click(139, 1050, 1, duration=4, button='left')
# 鼠标双击 \三击
# pyautogui.doubleClick(139, 1050, interval=1, duration=3)
# pyautogui.tripleClick(78, 1046, interval=1, duration=3)

# 鼠标的按下 松开
# pyautogui.mouseDown(78, 1046, duration=3)
# pyautogui.mouseUp(78, 1046, duration=3)


# 鼠标滑轮滚动
# pyautogui.scroll(-1000)

# 鼠标的无规则运动
# 开始很慢,后面加速
# pyautogui.moveTo(100, 100, 2, pyautogui.easeInQuad)
# 开始很快,后面减速
# pyautogui.moveTo(200, 200, 2, pyautogui.easeOutQuad)
# 开始结束很快,中间很慢
# pyautogui.moveTo(100, 100, 2, pyautogui.easeInOutQuad)
# 一步一徘徊
# pyautogui.moveTo(100, 100, 2, pyautogui.easeInBounce)
# 幅度最大的
pyautogui.moveTo(100, 100, 2, pyautogui.easeInElastic)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/121116
推荐阅读
相关标签
  

闽ICP备14008679号