-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.py
More file actions
138 lines (112 loc) · 3.69 KB
/
notification.py
File metadata and controls
138 lines (112 loc) · 3.69 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# from tkinter import *
# from tkinter import messagebox
# from PIL import Image,ImageTk
# from plyer import notification
# import time
# t=Tk()
# t.title("Notifier")
# t.geometry("500x400")
# # img=Image.open("notify_label.png")
# # Tkimg=ImageTk.PhotoImage(img)
# # img_label=Label(t,image=Tkimg).grid()
# #getdetails
# def get_Details():
# get_title=title.get()
# get_msg=msg.get()
# get_time=time1.get()
# if get_title=="" or get_msg==""or get_time=="":
# messagebox.showerror("Alert","All feilds are required!")
# else:
# int_time=int(float(get_time))
# min_to_sec=int_time*60
# messagebox.showinfo("Notifier set","set notification")
# time.sleep(min_to_sec)
# notification.notify(title=get_title,
# message=get_msg,
# app_name="notifier",
# )
# #label1
# t_label=Label(t,text="Title to notify:",font=("poppins",10))
# t_label.place(x=12,y=12)
# #entry1
# title=Entry(t,width="35",font=("poppins",13))
# title.place(x=120,y=12)
# #label2
# m_label=Label(t,text="Dispaly message:",font=("poppins",10))
# m_label.place(x=12,y=60)
# #entry2
# msg=Entry(t,width="35",font=("poppins",13))
# msg.place(x=125,y=60,height=30)
# #Label 3
# time_label =Label(t,text="Set Time:",font=("poppins",10))
# time_label.place(x=12,y=125)
# #entry3
# time1=Entry(t,width="5",font=("poppins",13))
# time1.place(x=100,y=125)
# #label 4
# time_min_label=Label(t,text="min",font=("poppins",10))
# time_min_label.place(x=160,y=125)
# #button
# but=Button(t,text="SET NOTIFICATION",font=("poppins",18,"bold"),fg="#ffffff",bg="#528DFF",width=15,relief="raised",command=get_Details)
# but.place(x=120,y=230)
# t.resizable(0,0)
# t.mainloop()
from tkinter import *
from PIL import Image, ImageTk
from plyer import notification
from tkinter import messagebox
import time
t = Tk()
t.title('Notifier')
t.geometry("500x300")
img = Image.open('notify_label.png')
tkimage = ImageTk.PhotoImage(img)
# get details
def get_details():
get_title = title.get()
get_msg = msg.get()
get_time = time1.get()
# print(get_title,get_msg, tt)
if get_title == "" or get_msg == "" or get_time == "":
messagebox.showerror("Alert", "All fields are required!")
else:
int_time = int(float(get_time))
min_to_sec = int_time * 60
messagebox.showinfo("notifier set", "set notification ?")
t.destroy()
time.sleep(min_to_sec)
notification.notify(title=get_title,
message=get_msg,
app_name="Notifier",
app_icon="ico.ico",
toast=True,
timeout=10)
# img_label = Label(t, image=tkimage).grid()
# Label - Title
t_label = Label(t, text="Title to Notify",font=("poppins", 10))
t_label.place(x=12, y=70)
# ENTRY - Title
title = Entry(t, width="25",font=("poppins", 13))
title.place(x=123, y=70)
# Label - Message
m_label = Label(t, text="Display Message", font=("poppins", 10))
m_label.place(x=12, y=120)
# ENTRY - Message
msg = Entry(t, width="40", font=("poppins", 13))
msg.place(x=123,height=30, y=120)
# Label - Time
time_label = Label(t, text="Set Time", font=("poppins", 10))
time_label.place(x=12, y=175)
# ENTRY - Time
time1 = Entry(t, width="5", font=("poppins", 13))
time1.place(x=123, y=175)
# Label - min
time_min_label = Label(t, text="min", font=("poppins", 10))
time_min_label.place(x=175, y=180)
# Button
but = Button(t, text="SET NOTIFICATION", font=("poppins", 10, "bold"), fg="#ffffff", bg="#528DFF", width=20,
relief="raised",
command=get_details)
but.place(x=170, y=230)
t.resizable(0,0)
t.mainloop()