-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.py
176 lines (131 loc) · 7.72 KB
/
main.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
from tkinter import*
from tkinter import ttk
from train import Train
from PIL import Image,ImageTk
from student import Student
from train import Train
from face_recognition import Face_Recognition
from attendance import Attendance
from developer import Developer
import os
from helpsupport import Helpsupport
class Face_Recognition_System:
def __init__(self,root):
self.root=root
self.root.geometry("1250x700+0+0")
self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt")
# This part is image labels setting start
# first header image
img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg")
img=img.resize((1250,120),Image.ANTIALIAS)
self.photoimg=ImageTk.PhotoImage(img)
# set image as lable
f_lb1 = Label(self.root,image=self.photoimg)
f_lb1.place(x=0,y=0,width=1250,height=120)
# backgorund image
bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg")
bg1=bg1.resize((1250,768),Image.ANTIALIAS)
self.photobg1=ImageTk.PhotoImage(bg1)
# set image as lable
bg_img = Label(self.root,image=self.photobg1)
bg_img.place(x=0,y=130,width=1250,height=768)
#title section
title_lb1 = Label(bg_img,text="Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt",font=("verdana",20,"bold"),bg="white",fg="navyblue")
title_lb1.place(x=0,y=0,width=1250,height=40)
# Create buttons below the section
# -------------------------------------------------------------------------------------------------------------------
# student button 1
std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\std1.jpg")
std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS)
self.std_img1=ImageTk.PhotoImage(std_img_btn)
std_b1 = Button(bg_img,command=self.student_pannels,image=self.std_img1,cursor="hand2")
std_b1.place(x=220,y=100,width=180,height=180)
std_b1_1 = Button(bg_img,command=self.student_pannels,text="Sinh Viên",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
std_b1_1.place(x=220,y=250,width=180,height=40)
# Detect Face button 2
det_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\det1.jpg")
det_img_btn=det_img_btn.resize((180,180),Image.ANTIALIAS)
self.det_img1=ImageTk.PhotoImage(det_img_btn)
det_b1 = Button(bg_img,command=self.face_rec,image=self.det_img1,cursor="hand2",)
det_b1.place(x=450,y=100,width=180,height=180)
det_b1_1 = Button(bg_img,command=self.face_rec,text="Nhận Diện",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
det_b1_1.place(x=450,y=250,width=180,height=40)
# Attendance System button 3
att_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\att.jpg")
att_img_btn=att_img_btn.resize((180,180),Image.ANTIALIAS)
self.att_img1=ImageTk.PhotoImage(att_img_btn)
att_b1 = Button(bg_img,command=self.attendance_pannel,image=self.att_img1,cursor="hand2",)
att_b1.place(x=680,y=100,width=180,height=180)
att_b1_1 = Button(bg_img,command=self.attendance_pannel,text="Điểm Danh",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
att_b1_1.place(x=680,y=250,width=180,height=40)
# Help Support button 4
hlp_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\hlp.jpg")
hlp_img_btn=hlp_img_btn.resize((180,180),Image.ANTIALIAS)
self.hlp_img1=ImageTk.PhotoImage(hlp_img_btn)
hlp_b1 = Button(bg_img,command=self.helpSupport,image=self.hlp_img1,cursor="hand2",)
hlp_b1.place(x=910,y=100,width=180,height=180)
hlp_b1_1 = Button(bg_img,command=self.helpSupport,text="Hỗ Trợ",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
hlp_b1_1.place(x=910,y=250,width=180,height=40)
# Top 4 buttons end.......
# ---------------------------------------------------------------------------------------------------------------------------
# Start below buttons.........
# Train button 5
tra_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\tra1.jpg")
tra_img_btn=tra_img_btn.resize((180,180),Image.ANTIALIAS)
self.tra_img1=ImageTk.PhotoImage(tra_img_btn)
tra_b1 = Button(bg_img,command=self.train_pannels,image=self.tra_img1,cursor="hand2",)
tra_b1.place(x=220,y=300,width=180,height=180)
tra_b1_1 = Button(bg_img,command=self.train_pannels,text="Tải Data",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
tra_b1_1.place(x=220,y=450,width=180,height=40)
# Photo button 6
pho_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\qr1.png")
pho_img_btn=pho_img_btn.resize((180,180),Image.ANTIALIAS)
self.pho_img1=ImageTk.PhotoImage(pho_img_btn)
pho_b1 = Button(bg_img,command=self.open_img,image=self.pho_img1,cursor="hand2",)
pho_b1.place(x=450,y=300,width=180,height=180)
pho_b1_1 = Button(bg_img,command=self.open_img,text="QR-Codes",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
pho_b1_1.place(x=450,y=450,width=180,height=40)
# Developers button 7
dev_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\dev.jpg")
dev_img_btn=dev_img_btn.resize((180,180),Image.ANTIALIAS)
self.dev_img1=ImageTk.PhotoImage(dev_img_btn)
dev_b1 = Button(bg_img,command=self.developr,image=self.dev_img1,cursor="hand2",)
dev_b1.place(x=680,y=300,width=180,height=180)
dev_b1_1 = Button(bg_img,command=self.developr,text="Developers",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
dev_b1_1.place(x=680,y=450,width=180,height=40)
# exit button 8
exi_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\exi.jpg")
exi_img_btn=exi_img_btn.resize((180,180),Image.ANTIALIAS)
self.exi_img1=ImageTk.PhotoImage(exi_img_btn)
exi_b1 = Button(bg_img,command=self.Close,image=self.exi_img1,cursor="hand2",)
exi_b1.place(x=910,y=300,width=180,height=180)
exi_b1_1 = Button(bg_img,command=self.Close,text="Thoát",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue")
exi_b1_1.place(x=910,y=450,width=180,height=40)
# ==================Funtion for Open Images Folder==================
def open_img(self):
os.startfile("dataset")
# ==================Functions Buttons=====================
def student_pannels(self):
self.new_window=Toplevel(self.root)
self.app=Student(self.new_window)
def train_pannels(self):
self.new_window=Toplevel(self.root)
self.app=Train(self.new_window)
def face_rec(self):
self.new_window=Toplevel(self.root)
self.app=Face_Recognition(self.new_window)
def attendance_pannel(self):
self.new_window=Toplevel(self.root)
self.app=Attendance(self.new_window)
def developr(self):
self.new_window=Toplevel(self.root)
self.app=Developer(self.new_window)
def helpSupport(self):
self.new_window=Toplevel(self.root)
self.app=Helpsupport(self.new_window)
def Close(self):
root.destroy()
if __name__ == "__main__":
root=Tk()
obj=Face_Recognition_System(root)
root.mainloop()