-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalarm_setter_basic.py
More file actions
28 lines (22 loc) · 964 Bytes
/
alarm_setter_basic.py
File metadata and controls
28 lines (22 loc) · 964 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
from datetime import datetime
from playsound import playsound
import tkinter
alarm_time = input("Set alarm time in HH:MM:SS\n") #input in 24-hour clock format
alarm_hour = alarm_time[0:2] #Takes HH
alarm_minute = alarm_time[3:5] #Takes MM
alarm_seconds = alarm_time[6:8] #Takes SS
print("Setting Alarm..")
while True:
current_time = datetime.now()
current_hour = current_time.strftime("%H")
current_minute = current_time.strftime("%M")
current_seconds = current_time.strftime("%S")
#debugging statements
#print("Current hour: {}, Current min:{} ,current sec:{}".format(current_hour,current_minute,current_seconds))
#print("The time is : {}".format(current_time))
if(current_hour == alarm_hour):
if(current_minute == alarm_minute):
if(current_seconds == alarm_seconds):
print("Wake Up!")
playsound('rooster.wav')
break