-
Notifications
You must be signed in to change notification settings - Fork 0
/
Admin.py
137 lines (97 loc) · 4.41 KB
/
Admin.py
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
#---------------------start-------------------
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 27 00:13:47 2019
@author: Manav
"""
from tkinter import *
from tkinter import ttk
import tkinter as tk
import sqlite3
import smtplib
from email.mime.text import MIMEText
from tkinter import messagebox
from scroll import ScrollableFrame
def sendmail(cgpa):
conn = sqlite3.connect('jobs.db')
cursor = conn.execute("SELECT name,email,cgpa from COMPANY ORDER BY cgpa");
cursor=list(cursor)
for row in cursor:
if row[2]>=cgpa:
body="You have to come at VESIT on date 10 April 2019 in Room No. 303"
msg=MIMEText(body)
fromaddr="[email protected]"
toaddr=row[1]
msg['From']=fromaddr
msg['To']=toaddr
msg['subject']=f"Congo {row[0]} you are selected for interview!!!"
server=smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(fromaddr,"papamareto")
server.send_message(msg)
print('Mail sent....')
server.quit()
else:
continue
conn.close()
messagebox.showinfo("Success","Conformation sent Successfully!")
root.destroy()
def fetch(cgpa):
conn = sqlite3.connect('jobs.db')
cursor = conn.execute("SELECT name,cgpa from COMPANY ORDER BY cgpa desc");
cursor=list(cursor)
'''frameT = tk.Frame(root, bg='white', bd=5)
frameT.place(relx=0.125, rely=0.32, relwidth=0.5, relheight=0.1)
label = tk.Label(frameT, text='Name', font=("Times","-30"), bg = "#593d25", fg = "White")
label.place(relwidth=1, relheight=1)
frameT = tk.Frame(root, bg='white', bd=5)
frameT.place(relx=0.64, rely=0.32, relwidth=0.25, relheight=0.1)
label = tk.Label(frameT, text='C.G.P.A', font=("Times","-30"), bg = "#593d25", fg = "White", bd=5)
label.place(relwidth=1, relheight=1)'''
r=Frame(root)
r.place(relx=0.1, rely=0.32)
frame = ScrollableFrame(r)
label = tk.Label(r, text='Name - cgpa', font=("Times","-30"), bg = "black", fg = "White")
label.pack(fill=X)
for row in cursor:
if row[1]>=cgpa:
#-----------name--------
frameT = tk.Frame(frame.scrollable_frame, bd=5)
frameT.pack(fill=X)
label1 = tk.Label(frameT, text=row[0], font=("Times","-30"), bg = "#593d25", fg = "White")
label1.pack(side=LEFT,padx=20)
#----------cgpa-----------
label2 = tk.Label(frameT, text=row[1], font=("Times","-30"), bg = "#593d25", fg = "White")
label2.pack(side=RIGHT,padx=40)
else:
continue
frame.pack()
frameB = tk.Frame(root, bg='white', bd=5)
frameB.place(relx=0.75, rely=0.9, relwidth=0.25, relheight=0.07, anchor='n')
button = tk.Button(frameB, text="Send Conformation", font=("Times","-25"),bg = "#593d25",fg = "White",activebackground="#b79374",command=lambda: sendmail(float(cgpa)))
button.place(relheight=1, relwidth=1)
conn.close()
HEIGHT = 580
WIDTH = 1000
root = tk.Tk()
canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)
canvas.pack()
background_image = tk.PhotoImage(file='Page1.png')
background_label = tk.Label(root, image=background_image)
background_label.place(relwidth=1, relheight=1)
#-------Title----------
frameT = tk.Frame(root, bg='white', bd=5)
frameT.place(relx=0.5, rely=0.075, relwidth=0.85, relheight=0.1, anchor='n')
label = tk.Label(frameT, text="Admin Page", font=("Times","-30"), bg = "#593d25", fg = "White")
label.place(relwidth=1, relheight=1)
#--------Text------
frameCT = tk.Frame(root, bg='white', bd=5)
frameCT.place(relx=0.13, rely=0.2, relwidth=0.4, relheight=0.075)
cgpa = tk.Entry(frameCT, font=("Times","-25"))
cgpa.place(relwidth=1, relheight=1)
#--------Search-------
frame = tk.Frame(root, bg='white', bd=5)
frame.place(relx=0.57, rely=0.2, relwidth=0.3, relheight=0.075)
button = tk.Button(frame, text="Search", font=("Times","-25"),bg = "#593d25",fg = "White",activebackground="#b79374",command =lambda: fetch(float(cgpa.get())))
button.place(relheight=1, relwidth=1)
root.mainloop()