【问题标题】:How do you hold down left click with python?你如何用python按住左键?
【发布时间】:2021-03-17 04:41:16
【问题描述】:

我知道您可以使用 pyautogui 按住某些键,但是有没有办法使用 keyDown 和 keyUp(或其他模块)按住左键?如果您能提供帮助,请提前致谢。

【问题讨论】:

  • 您的意思是:pyautogui.mouseDown()
  • 是的,我确实做到了,谢谢!如果您将此作为答案发布,我会接受它

标签: python keyboard click pyautogui


【解决方案1】:

documentation你可以使用mouseDown()

>>> pyautogui.mouseDown(); pyautogui.mouseUp()  # does the same thing as a left-button mouse click
>>> pyautogui.mouseDown(button='right')  # press the right button down
>>> pyautogui.mouseUp(button='right', x=100, y=200)  # move the mouse to 100, 200, then release the right button up.

【讨论】:

    【解决方案2】:
    pyautogui.click()                   # Left click
    pyautogui.click(button='right')     # Right click
    

    This是pyautogui鼠标控制功能的文档。

    【讨论】:

      猜你喜欢
      • 2021-10-08
      • 1970-01-01
      • 2010-12-31
      • 2014-05-08
      • 2013-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多