-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtriggerSpam.py
50 lines (38 loc) · 1.25 KB
/
triggerSpam.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
from spam import Spam
import cv2 as cv
import tkinter as tk
class App:
def __init__(self, window):
self.spam = Spam('Diablo IV')
self.window = window
self.running = False
self.start_button = tk.Button(window, text='Start', width=25, command=self.start_command)
self.start_button.pack()
self.stop_button = tk.Button(window, text='Stop', width=25, command=self.stop_command)
self.stop_button.pack()
def start_command(self):
self.spam.start()
print('Start Button Pressed')
self.running = True
self.loop()
def stop_command(self):
print('Stop Button Pressed')
self.running = False
self.spam.stop()
def loop(self):
try:
if self.running:
# Replace with your code
print('Loop iteration')
self.spam.found = True
# Schedule the next iteration; 1000 ms = 1 s
self.window.after(1000, self.loop)
except KeyboardInterrupt:
self.running = False
self.spam.stop()
print('Exiting')
exit(0)
window = tk.Tk()
window.title('My App')
app = App(window)
window.mainloop()