-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimerOSX.py
More file actions
36 lines (28 loc) · 761 Bytes
/
timerOSX.py
File metadata and controls
36 lines (28 loc) · 761 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
32
33
34
35
36
#!/usr/bin/python3
import time
import datetime
import os
title = "Get Up"
message = "Time is up. Step away from the computer."
command = f'''
osascript -e 'display notification "{message}" with title "{title}"title
afplay '/System/Library/Sounds/Blow.aiff'
'''
def clear_console():
os.system('clear')
def countdown(h, m, s):
while True:
total_seconds = h * 3600 + m * 60 + s
while total_seconds > 0:
timer = datetime.timedelta(seconds = total_seconds)
print(timer, end="\r")
time.sleep(1)
total_seconds -= 1
print("Get Up ")
os.system(command)
input("Press Enter to continue...")
clear_console()
h = 0
m = 25
s = 0
countdown(int(h), int(m), int(s))