-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountDown.py
More file actions
30 lines (29 loc) · 1 KB
/
Copy pathCountDown.py
File metadata and controls
30 lines (29 loc) · 1 KB
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
import sys,time
import sevseg
secondsLeft = 30
try:
while True:
print('\n'*60)
hours = str(secondsLeft // 3600)
minutes = str((secondsLeft % 3600) // 60)
seconds = str(secondsLeft % 60)
hDigits = sevseg.getSevSegStr(hours,2)
hTopRow,hMiddleRow,hBottomRow = hDigits.splitlines()
mDigits = sevseg.getSevSegStr(minutes,2)
mTopRow,mMiddleRow,mBottomRow = mDigits.splitliness()
sDigits = sevseg.getSevSegStr(seconds,2)
sTopRow,sMiddleRow,sBottomRow = sDigits.splitlines()
print(hTopRow + ' '+ mTopRow + ' '+sTopRow)
print(hMiddleRow + ' * ' + mMiddleRow + ' * ' + sMiddleRow)
print(hBottomRow + ' * ' + mBottomRow + ' * ' + sBottomRow)
if secondsLeft == 0:
print()
print(' ****BOOM****')
break
print()
print('Press Ctrl-C to quit.')
time.sleep(1)
secondsLeft -= 1
except KeyboardInterrupt:
print('Countdown,by sinstergeek')
sys.exit()