-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_clicker.py
More file actions
40 lines (32 loc) · 1.24 KB
/
auto_clicker.py
File metadata and controls
40 lines (32 loc) · 1.24 KB
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
import pyautogui
import time
import tkinter as tk
# create the GUI window
root = tk.Tk()
root.title("Auto Clicker")
# create the duration input label and field
duration_label = tk.Label(root, text="Duration (in seconds): ")
duration_label.pack(side=tk.LEFT)
duration_entry = tk.Entry(root)
duration_entry.pack(side=tk.LEFT)
# create the timing input label and field
timing_label = tk.Label(root, text="Timing (in clicks per second): ")
timing_label.pack(side=tk.LEFT)
timing_entry = tk.Entry(root)
timing_entry.pack(side=tk.LEFT)
# function to start the auto clicker
def start_clicker():
# get the duration and timing values from the GUI
duration = int(duration_entry.get())
timing = float(timing_entry.get())
# calculate the number of clicks based on duration and timing
num_clicks = int(duration * timing)
# loop through the specified number of clicks and simulate a left-click
for i in range(num_clicks):
pyautogui.click()
time.sleep(1/timing) # delay between clicks based on timing
# create the start button and pack it into the GUI
start_button = tk.Button(root, text="Start Auto Clicker", command=start_clicker)
start_button.pack()
# run the GUI loop
root.mainloop()