-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcountdownTimer.py
More file actions
33 lines (26 loc) · 903 Bytes
/
countdownTimer.py
File metadata and controls
33 lines (26 loc) · 903 Bytes
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
import threading
import time
class TimerClass(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.event = threading.Event()
self.count = 30
def run(self):
while self.count > 0 and not self.event.is_set():
print (self.count)
if self.count < 155:
self.setInd(1, 1) # "Talk"
self.setInd(2, 0)
self.setInd(3, 0)
elif self.count > 15 and self.count < 30:
self.setInd(1, 0) # "Sum-up"
self.setInd(2, 1)
self.setInd(3, 0)
else:
self.setInd(1, 0) # "Stop"
self.setInd(2, 0)
self.setInd(3, 1)
self.count -= 1
self.event.wait(1)
def stop(self):
self.event.set()