Skip to content

Commit bd35f48

Browse files
authored
Add files via upload
1 parent f936d8b commit bd35f48

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Diff for: Python/Alarm_Clock_with_GUI/Alarm_Clock_with_GUI.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from playsound import playsound
2+
from tkinter import *
3+
from win10toast import ToastNotifier
4+
import datetime
5+
import time
6+
7+
def alarm(set_alarm):
8+
toast = ToastNotifier()
9+
while True:
10+
time.sleep(1)
11+
date = datetime.datetime.now()
12+
now = date.strftime("%H:%M:%S")
13+
print(now)
14+
if now == set_alarm:
15+
print("Alarm Clock")
16+
toast.show_toast("Alarm Clock",duration=1)
17+
playsound("alarm.mp3")
18+
19+
def getvalue():
20+
set_alarm = f"{hour.get()}:{min.get()}:{sec.get()}"
21+
alarm(set_alarm)
22+
23+
root = Tk()
24+
root.geometry("170x110")
25+
info = Label(root,text = "(24)Hour Min Sec").place(x = 50)
26+
set_time = Label(root,text = "Set Time",relief = "solid",font=("Cambria",10,"bold")).place(x=0,y=30)
27+
28+
# Entry Variables
29+
hour = StringVar()
30+
min = StringVar()
31+
sec = StringVar()
32+
33+
# Entry Widget
34+
hour_E = Entry(root,textvariable = hour,bg = "grey",width = 4).place(x=60,y=30)
35+
min_E = Entry(root,textvariable = min,bg = "grey",width = 4).place(x=90,y=30)
36+
sec_E = Entry(root,textvariable = sec,bg = "grey",width = 4).place(x=120,y=30)
37+
38+
submit = Button(root,text = "Set Alarm",width = 10,command = getvalue).place(x =50,y=70)
39+
40+
root.mainloop()

Diff for: Python/Alarm_Clock_with_GUI/Output 1.JPG

35.1 KB
Loading

Diff for: Python/Alarm_Clock_with_GUI/Output 2.JPG

26.3 KB
Loading

Diff for: Python/Alarm_Clock_with_GUI/Output.JPG

11.6 KB
Loading

0 commit comments

Comments
 (0)