简体   繁体   English

为什么我在 python 中的自动点击器不起作用?

[英]Why is my autoclicker in python not working?

I'm still a newbie, don't be angry if I make some mistakes:) So, I wanted to code an auto clicker with a little interface, where I can enter the size of the interval between each click.我还是个新手,如果我犯了一些错误不要生气:) 所以,我想编写一个带有小界面的自动点击器,我可以在其中输入每次点击之间的间隔大小。 Here's the code:这是代码:

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()

When I run it, the little window opens, I enter the interval, and press "Go".当我运行它时,小 window 打开,我进入区间,然后按“Go”。 Nothing happens.什么都没发生。 What did I do wrong?我做错了什么?

There isn't anything wrong with your code but you probably didn't notice anything happening because there wasn't anything in particular to notice.您的代码没有任何问题,但您可能没有注意到任何事情发生,因为没有什么特别需要注意的。 Try doing this:尝试这样做:

  1. The value you input in time interval is the time the auto clicker pauses before clicking anything so set it to something like 2 sec.您在时间间隔中输入的值是自动点击器在点击任何内容之前暂停的时间,因此请将其设置为 2 秒。

  2. Choose left click and click go选择左键单击并单击 go

  3. Now within 2 sec move your mouse cursor to an app on your desktop and now that app will be selected after 2 sec现在在 2 秒内将鼠标 cursor 移动到桌面上的应用程序,现在该应用程序将在 2 秒后被选中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM