How to make autoclicker in python with GUI?

Viewed 39

I try make own autoclicker with GUI but I don't know how make CPS(Clicks per second). I have tried in different ways but nothing work. Please for help with solution on this problem.

from tkinter import *
import time

running = False
cps_counter = 0

def scanning():
    global cps_counter
    cps_chk = cpscheck.get()
    delay = 1/int(cps_chk)
    if running:
        cps_counter += 1
        label.configure(text=f'{cps_counter}')
        time.sleep(delay)

def start():
    global running
    if running == False:
        running = True
    else:
        running = False

window = Tk()
window.title("Title")
window.geometry("500x500")

start = Button(window, text="Start/Stop Scan", command=start)
start.grid()
cpscheck = StringVar()

textBox = Entry(bd=0, bg="#545454", highlightthickness=0, textvariable=cpscheck, font=("Helvetica", 20), fg="white", justify='center')
textBox.place( x=250, y=123, width=85.0, height=25)

label = Label(text=cps_counter)
label.place(x=100, y=100)

window.after(100, scanning)  # After 1 second, call scanning
window.mainloop()
0 Answers
Related