-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
60 lines (43 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
import tkinter as tk
from threading import Thread
from cookie_clicker_bot import CookieClickerBot
class App:
def __init__(self):
self.create_variables()
self.window_setup()
self.create_start_gui()
self.bot_thread = None
self.run()
def create_variables(self):
self.clicking = False
def window_setup(self):
self.WINDOW = tk.Tk()
self.WINDOW.title("CookieClikerBotGUI")
def open_clicker(self):
self.clicker = CookieClickerBot()
self.clicker.stop_clicking = True
self.bot_thread = Thread(target=self.clicker.click_cookie)
self.bot_thread.start()
self.create_gui()
def create_gui(self):
self.open_website_button.pack_forget()
self.start_stop_button = tk.Button(self.WINDOW, text="Start Clicker", command=self.toggle_clicker, width=20, height=2)
self.start_stop_button.pack(padx=10, pady=10)
def create_start_gui(self):
self.open_website_button = tk.Button(self.WINDOW, text="Open Website", command=self.open_clicker, width=20, height=2)
self.open_website_button.pack(padx=10, pady=10)
def toggle_clicker(self):
if self.clicking:
self.clicking = False
self.clicker.stop_clicking = True
self.start_stop_button.config(text="Start Clicker")
else:
self.clicking = True
self.clicker.stop_clicking = False
self.bot_thread = Thread(target=self.clicker.click_cookie)
self.bot_thread.start()
self.start_stop_button.config(text="Stop Clicker")
def run(self):
self.WINDOW.mainloop()
if __name__ == "__main__":
App().run()