diff --git a/Python/Alarm_Clock_with_GUI/Alarm_Clock_with_GUI.py b/Python/Alarm_Clock_with_GUI/Alarm_Clock_with_GUI.py new file mode 100644 index 00000000..a5d86f7b --- /dev/null +++ b/Python/Alarm_Clock_with_GUI/Alarm_Clock_with_GUI.py @@ -0,0 +1,40 @@ +from playsound import playsound +from tkinter import * +from win10toast import ToastNotifier +import datetime +import time + +def alarm(set_alarm): + toast = ToastNotifier() + while True: + time.sleep(1) + date = datetime.datetime.now() + now = date.strftime("%H:%M:%S") + print(now) + if now == set_alarm: + print("Alarm Clock") + toast.show_toast("Alarm Clock",duration=1) + playsound("alarm.mp3") + +def getvalue(): + set_alarm = f"{hour.get()}:{min.get()}:{sec.get()}" + alarm(set_alarm) + +root = Tk() +root.geometry("170x110") +info = Label(root,text = "(24)Hour Min Sec").place(x = 50) +set_time = Label(root,text = "Set Time",relief = "solid",font=("Cambria",10,"bold")).place(x=0,y=30) + +# Entry Variables +hour = StringVar() +min = StringVar() +sec = StringVar() + +# Entry Widget +hour_E = Entry(root,textvariable = hour,bg = "grey",width = 4).place(x=60,y=30) +min_E = Entry(root,textvariable = min,bg = "grey",width = 4).place(x=90,y=30) +sec_E = Entry(root,textvariable = sec,bg = "grey",width = 4).place(x=120,y=30) + +submit = Button(root,text = "Set Alarm",width = 10,command = getvalue).place(x =50,y=70) + +root.mainloop() \ No newline at end of file diff --git a/Python/Alarm_Clock_with_GUI/Output 1.JPG b/Python/Alarm_Clock_with_GUI/Output 1.JPG new file mode 100644 index 00000000..05e9cd93 Binary files /dev/null and b/Python/Alarm_Clock_with_GUI/Output 1.JPG differ diff --git a/Python/Alarm_Clock_with_GUI/Output 2.JPG b/Python/Alarm_Clock_with_GUI/Output 2.JPG new file mode 100644 index 00000000..bace121e Binary files /dev/null and b/Python/Alarm_Clock_with_GUI/Output 2.JPG differ diff --git a/Python/Alarm_Clock_with_GUI/Output.JPG b/Python/Alarm_Clock_with_GUI/Output.JPG new file mode 100644 index 00000000..b11bd3f1 Binary files /dev/null and b/Python/Alarm_Clock_with_GUI/Output.JPG differ diff --git a/Python/Alarm_Clock_with_GUI/README.md b/Python/Alarm_Clock_with_GUI/README.md new file mode 100644 index 00000000..b8b6682a --- /dev/null +++ b/Python/Alarm_Clock_with_GUI/README.md @@ -0,0 +1,10 @@ +# Alarm Clock with GUI + +## How to Run? + +* Install win10toast and playsound +* Run 'Alarm Clock with GUI.py' + +## Output + +![Output](Output.JPG)