-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
74 lines (61 loc) · 1.86 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
73
74
import time
from tk import getentry, buttons1, tkinterloop, update
import threading
import keyboard
import mouse
global_boolean = False # will be changed to see if user input time is changed
def hotkey():
while True:
if keyboard.is_pressed(hot_key):
if buttons1.ONOFF.get() == 1:
buttons1.ONOFF.set(0)
time.sleep(.5)
else:
buttons1.ONOFF.set(1)
time.sleep(.5)
else:
time.sleep(.05)
def mainloop():
global global_boolean
while True:
if buttons1.ONOFF.get() == 1:
try:
if float(getentry()) > 5.0:
for i in range(int(getentry())):
print(i)
time.sleep(1)
if global_boolean:
global_boolean = False
break
mouse.click(button="left")
time.sleep(0.05)
else:
time.sleep(float(getentry()))
mouse.click(button="left")
except:
update()
time.sleep(.5)
continue
else:
update()
time.sleep(.5)
def time_change_checker():
global global_boolean
while True:
time.sleep(3)
current_sleep_time = getentry()
time.sleep(1)
if current_sleep_time != getentry():
global_boolean = True
if __name__ == '__main__':
file = open("config.txt")
hot_key = file.read()
file.close()
thread1 = threading.Thread(target=mainloop)
thread2 = threading.Thread(target=hotkey)
thread3 = threading.Thread(target=time_change_checker)
thread1.start()
thread2.start()
thread3.start()
tkinterloop()
# image sorter/ video sorter sorts by date or smth