【问题标题】:Why is my autoclicker in python not working?为什么我在 python 中的自动点击器不起作用?
【发布时间】:2021-02-18 09:49:43
【问题描述】:

我还是个新手,如果我犯了一些错误不要生气:) 所以,我想编写一个带有小界面的自动点击器,我可以在其中输入每次点击之间的间隔大小。代码如下:

import pyautogui
import appJar

pyautogui.PAUSE = 0.01


def buttonPress(button):
    if (button == "Go"):
        amount = float(app.getEntry("amount"))
        button = app.radioButton("click")
        if (button == "Right Click"):
            button = "right"
        else:
            button = "left"
        
        pyautogui.click(button=button, interval=amount)


app = appJar.gui("autoclicker")
app.setSize("300x200")
app.setSticky("new")
app.addLabel("Enter size of Intervall between clicks", row=0)
app.addEntry("amount", row=1)
app.addButton("Go", buttonPress, row=3)
app.setSticky("e")
app.radioButton("click", "Right Click", row=2)
app.setSticky("w")
app.radioButton("click", "Left Click", row=2)

app.go()

当我运行它时,小窗口打开,我输入间隔,然后按“Go”。 什么都没发生。我做错了什么?

【问题讨论】:

    标签: python pyautogui appjar


    【解决方案1】:

    您的代码没有任何问题,但您可能没有注意到任何事情发生,因为没有什么特别需要注意的。 尝试这样做:

    1. 您在时间间隔中输入的值是自动点击器在点击任何内容之前暂停的时间,因此请将其设置为 2 秒。

    2. 选择左键点击前往

    3. 现在在 2 秒内将鼠标光标移动到桌面上的应用程序,现在该应用程序将在 2 秒后被选中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 2020-08-14
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 2020-12-27
      相关资源
      最近更新 更多