4
4
import pyautogui
5
5
import customtkinter
6
6
import threading
7
- import pydirectinput
8
7
9
8
customtkinter .set_appearance_mode ("black" )
10
9
customtkinter .set_default_color_theme ("blue" )
13
12
holdm_key = Key .f6
14
13
15
14
button1 = "left"
15
+ clicktype = "Single"
16
16
17
17
pause = False
18
18
@@ -23,7 +23,7 @@ class App(customtkinter.CTk):
23
23
auto1 = False
24
24
25
25
WIDTH = 300
26
- HEIGHT = 500
26
+ HEIGHT = 510
27
27
28
28
def __init__ (self ):
29
29
super ().__init__ ()
@@ -78,12 +78,37 @@ def __init__(self):
78
78
self .buttonmenu_var = customtkinter .StringVar (value = "left" )
79
79
80
80
self .buttonmenu = customtkinter .CTkOptionMenu (master = self .frame , text_font = (
81
- "Roboto Medium" , - 16 ), width = 100 , fg_color = "black" , button_color = "black" , variable = self .buttonmenu_var , command = self .buttonmenu_event , values = ["left" , "middle" , "right" ])
82
- self .buttonmenu .place (x = 90 , y = 370 )
81
+ "Roboto Medium" , - 14 ), width = 100 , fg_color = "black" , button_color = "black" , variable = self .buttonmenu_var , command = self .buttonmenu_event , values = ["left" , "middle" , "right" ])
82
+ self .buttonmenu .place (x = 30 , y = 370 )
83
83
84
84
self .mousebuttontxt = customtkinter .CTkLabel (
85
- master = self .frame , text = "Mouse Button:" , text_font = ("Roboto Medium" , - 16 ))
86
- self .mousebuttontxt .place (x = 70 , y = 340 )
85
+ master = self .frame , text = "Mouse Button:" , text_font = ("Roboto Medium" , - 15 ))
86
+ self .mousebuttontxt .place (x = 12 , y = 340 )
87
+
88
+ self .clicktype_var = customtkinter .StringVar (value = "Single" )
89
+
90
+ self .clicktypemenu = customtkinter .CTkOptionMenu (master = self .frame , text_font = (
91
+ "Roboto Medium" , - 14 ), width = 100 , fg_color = "black" , button_color = "black" , variable = self .clicktype_var , command = self .clicktype_event , values = ["Single" , "Double" ])
92
+ self .clicktypemenu .place (x = 150 , y = 370 )
93
+
94
+ self .clicktypetxt = customtkinter .CTkLabel (
95
+ master = self .frame , text = "Click Type:" , text_font = ("Roboto Medium" , - 15 ))
96
+ self .clicktypetxt .place (x = 130 , y = 340 )
97
+
98
+ self .clickinterval_var = customtkinter .StringVar (
99
+ master = self .frame , value = str (0.01 ))
100
+
101
+ self .clickinterval = customtkinter .CTkEntry (master = self .frame , text_font = (
102
+ "Roboto Medium" , - 14 ), width = 80 , textvariable = self .clickinterval_var )
103
+ self .clickinterval .place (x = 100 , y = 440 )
104
+
105
+ self .clickintervaltxt = customtkinter .CTkLabel (
106
+ master = self .frame , text = "Click interval" , text_font = ("Roboto Medium" , - 14 ))
107
+ self .clickintervaltxt .place (x = 70 , y = 410 )
108
+
109
+ self .secondstxt = customtkinter .CTkLabel (
110
+ master = self .frame , text = "seconds" , text_font = ("Roboto Medium" , - 13 ), width = 10 )
111
+ self .secondstxt .place (x = 185 , y = 445 )
87
112
88
113
def buttonmenu_event (self , choice ):
89
114
global button1
@@ -95,6 +120,14 @@ def buttonmenu_event(self, choice):
95
120
if choice == "right" :
96
121
button1 = "right"
97
122
123
+ def clicktype_event (self , choice ):
124
+ global clicktype
125
+
126
+ if choice == "Single" :
127
+ clicktype = "Single"
128
+ if choice == "Double" :
129
+ clicktype = "Double"
130
+
98
131
def start_button1 (self ):
99
132
threading .Thread (target = self .autoHold ).start ()
100
133
self .start_hold_button .configure (state = "disabled" )
@@ -144,33 +177,57 @@ def autoClick(self):
144
177
lis = Listener (on_press = self .on_press )
145
178
lis .start ()
146
179
180
+ self .interval = float (self .clickinterval .get ())
181
+
147
182
while self .auto1 :
148
183
if not pause :
149
- if button1 == "left" :
150
- pyautogui .leftClick ()
151
- if button1 == "middle" :
152
- pyautogui .middleClick ()
153
- if button1 == "right" :
154
- pyautogui .rightClick ()
184
+ if button1 == "left" and clicktype == "Single" :
185
+ pyautogui .click (button = "left" )
186
+ pyautogui .PAUSE = self .interval
187
+ if button1 == "middle" and clicktype == "Single" :
188
+ pyautogui .click (button = "middle" )
189
+ pyautogui .PAUSE = self .interval
190
+ if button1 == "right" and clicktype == "Single" :
191
+ pyautogui .click (button = "right" )
192
+ pyautogui .PAUSE = self .interval
193
+
194
+ if button1 == "left" and clicktype == "Double" :
195
+ pyautogui .doubleClick (button = "left" )
196
+ pyautogui .PAUSE = self .interval
197
+ if button1 == "middle" and clicktype == "Double" :
198
+ pyautogui .doubleClick (button = "middle" )
199
+ pyautogui .PAUSE = self .interval
200
+ if button1 == "right" and clicktype == "Double" :
201
+ pyautogui .doubleClick (button = "right" )
202
+ pyautogui .PAUSE = self .interval
155
203
if pause :
156
204
break
157
205
lis .stop ()
158
206
159
207
def stop_button1 (self ):
160
208
pause = True
161
209
self .auto = False
210
+
162
211
if button1 == "left" :
163
212
pyautogui .mouseUp (button = "left" )
164
213
if button1 == "middle" :
165
214
pyautogui .mouseUp (button = "middle" )
166
215
if button1 == "right" :
167
216
pyautogui .mouseUp (button = "right" )
217
+
168
218
self .start_hold_button .configure (state = "enabled" )
169
219
170
220
def stop_button2 (self ):
171
221
pause = True
172
222
self .auto1 = False
173
- pyautogui .mouseUp ()
223
+
224
+ if button1 == "left" and clicktype == "Single" :
225
+ pyautogui .mouseUp (button = "left" )
226
+ if button1 == "middle" and clicktype == "Single" :
227
+ pyautogui .mouseUp (button = "middle" )
228
+ if button1 == "right" and clicktype == "Single" :
229
+ pyautogui .mouseUp (button = "right" )
230
+
174
231
self .start_auto_button .configure (state = "enabled" )
175
232
176
233
def on_close (self , event = 0 ):
0 commit comments