-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
72 lines (55 loc) · 1.68 KB
/
main.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pyautogui
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.core.window import Window
from KivyOnTop import register_topmost
from kivy.config import Config
from pynput import keyboard
Window.size = (400,200)
class Panel(FloatLayout):
slider = ObjectProperty(None)
btn = ObjectProperty(None)
def __init__(self, **kwargs):
super(Panel, self).__init__(**kwargs)
Panel.create_listener(self)
self.on = False
def activate_autoclicker(self):
self.slider.disabled = True
pyautogui.PAUSE = 1 / self.slider.value
Clock.schedule_interval(self.click, 0.001)
def stop_autoclicker(self):
self.slider.disabled = False
Clock.unschedule(self.click)
def change_button(self):
if self.on:
self.btn.background_color = (.157, .455, .753, 1)
self.btn.text = "START"
self.stop_autoclicker()
else:
self.btn.background_color = (1, .4, 0, 1)
self.btn.text = "STOP"
self.activate_autoclicker()
self.on = not self.on
def click(self, *args):
pyautogui.click()
def on_release(self, key, *args):
if keyboard.Key.f4 in args:
self.change_button()
def create_listener(self):
listener = keyboard.Listener(on_release=lambda key, *args: self.on_release(self, key, *args))
listener.start()
kv = Builder.load_file("kv.kv")
class MyApp(App):
App.title = "AutoClicker"
def build(self):
return kv
def on_start(self, *args):
Window.set_title("ULTRA CLICKER")
register_topmost(Window, "ULTRA CLICKER")
if __name__ == "__main__":
MyApp().run()