-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesktop_notifier.py
More file actions
75 lines (55 loc) · 2.37 KB
/
desktop_notifier.py
File metadata and controls
75 lines (55 loc) · 2.37 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from tkinter import *
from plyer import notification
from tkinter import messagebox
BG_COLOR = "#567189"
def noti_printer():
title_text_entry = title_entry.get()
message_entry = msg_entry.get()
print("hehe")
notification.notify(title=title_text_entry,
message= message_entry,
app_name= "Desktop Notifier",
timeout= 10)
window.quit()
def timer():
title_text_entry = title_entry.get().strip()
message_entry = msg_entry.get().strip()
time_unit_set = time_unit.get()
time_set = int(time_entry.get())
if len(title_text_entry) == 0 or len(message_entry) == 0:
messagebox.showerror(title= "Error",message=("Please dont leave any fields empty").capitalize())
else:
if time_unit_set == "sec":
window.after(time_set*1000,noti_printer)
else:
window.after(time_set*60000,noti_printer)
print(time_set,"gg")
window = Tk()
window.title("Desktop Notifier")
window.config(bg=BG_COLOR,width=500,height= 250)
window.resizable(False,False)
label = Label(text=("Desktop Notifier").upper())
label.config(bg=BG_COLOR,font=("arial",15),fg="gold")
label.grid(row=0,column=0,padx=20,pady=20)
title_label = Label(text="Title : ",bg=BG_COLOR,font=("arial",20,"normal"))
title_label.grid(row=1,column=0)
msg_label = Label(text="Message :",font=("arial",20,"normal"),bg=BG_COLOR)
msg_label.grid(row=2,column=0)
time_label = Label(text="Set Time :",font=("arial",20,"normal"),bg=BG_COLOR)
time_label.grid(row=3,column=0)
title_entry = Entry(width=50,)
title_entry.grid(row=1,column=1,pady=20,padx=10)
title_entry.focus()
msg_entry = Entry(width=50)
msg_entry.grid(row=2,column=1,padx=20,pady=20)
time_entry = Spinbox(width=5,from_=1,to=60,increment=1,font=("arial",15))
time_entry.grid(row=3,column=1,pady=20,padx=10)
noti_but = Button(text="Set Notification",width=20,font=("arial",15),command=timer)
noti_but.grid(row=4,column=1,pady=20,padx=20)
noti_but.config(padx=10,borderwidth=10,relief="ridge",fg="gold",bg="#181D31")
time_unit = StringVar(value="sec")
min_rad = Radiobutton(text="min",bg=BG_COLOR,variable=time_unit,value="min")
min_rad.place(x=450,y=210)
sec_rad = Radiobutton(text="sec",bg=BG_COLOR,variable=time_unit,value="sec")
sec_rad.place(x=500,y=210)
window.mainloop()