Student Management System
Source code :
from tkinter import *
from tkinter import ttk
from PIL import Image,ImageTk
from tkinter import messagebox
class Student:
def __init__(self,root):
self.root=root
self.root.geometry("1366x768+0+0")
self.root.title("Face Recognition System")
#variables
self.var_dep=StringVar()
self.var_course=StringVar()
self.var_year=StringVar()
self.var_semester=StringVar()
self.var_std_id=StringVar()
self.var_std_name=StringVar()
self.var_div=StringVar()
self.var_roll=StringVar()
img=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\s1.jpg")
img=img.resize((500,130),Image.ANTIALIAS)
self.photoimg=ImageTk.PhotoImage(img)
f_lbl=Label(self.root,image=self.photoimg)
f_lbl.place(x=0,y=0,width=500,height=130)
img1=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\s2.jpg")
img1=img1.resize((500,130),Image.ANTIALIAS)
self.photoimg1=ImageTk.PhotoImage(img1)
f_lbl=Label(self.root,image=self.photoimg1)
f_lbl.place(x=500,y=0,width=500,height=130)
img2=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\s3.jpg")
img2=img2.resize((500,130),Image.ANTIALIAS)
self.photoimg2=ImageTk.PhotoImage(img2)
f_lbl=Label(self.root,image=self.photoimg2)
f_lbl.place(x=1000,y=0,width=500,height=130)
img3=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\i11.png")
img3=img3.resize((1366,768),Image.ANTIALIAS)
self.photoimg3=ImageTk.PhotoImage(img3)
bg_img=Label(self.root,image=self.photoimg3)
bg_img.place(x=0,y=130,width=1366,height=768)
titlt_lbl=Label(bg_img,text="STUDENT MANAGMENT SYSTEM",font=("times new roman",35,"bold italic"),bg="white",fg="sky blue")
titlt_lbl.place(x=0,y=0,width=1366,height=45)
main_frame=Frame(bg_img,bd=2,bg="white")
main_frame.place(x=0,y=55,width=1366,height=600)
# left side label frame
Left_frame=LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Student Details",font=("time new roman",12,"bold"))
Left_frame.place(x=10,y=10,width=710,height=490)
img_left=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\s4.jpg")
img_left=img_left.resize((700,130),Image.ANTIALIAS)
self.photoimg_left=ImageTk.PhotoImage(img_left)
f_lbl=Label(Left_frame,image=self.photoimg_left)
f_lbl.place(x=5,y=0,width=700,height=130)
#current course
current_course_frame=LabelFrame(Left_frame,bd=2,bg="white",relief=RIDGE,text="Current Course Information",font=("time new roman",12,"bold"))
current_course_frame.place(x=5,y=135,width=680,height=150)
#Department
dep_label=Label(current_course_frame,text="Department",font=("time new roman",13,"bold"),bg="white")
dep_label.grid(row=0,column=0,padx=10,sticky=W)
dep_combo=ttk.Combobox(current_course_frame,textvariable=self.var_dep,font=("time new roman",13,"bold"),state="readonly",width=20)
dep_combo["values"]=("Select Department","COMPUTER SCIENCE","IT","CIVIL","MECHANICAL")
dep_combo.current(0)
dep_combo.grid(row=0,column=1,padx=2,pady=10,sticky=W)
#course
course_label=Label(current_course_frame,text="Course",font=("time new roman",13,"bold"),bg="white")
course_label.grid(row=0,column=2,padx=10,sticky=W)
course_combo=ttk.Combobox(current_course_frame,textvariable=self.var_course,font=("time new roman",13,"bold"),state="readonly",width=20)
course_combo["values"]=("Select Course","Polytechnic","B.tech")
course_combo.current(0)
course_combo.grid(row=0,column=3,padx=2,pady=10,sticky=W)
#year
year_label=Label(current_course_frame,text="Select Year",font=("time new roman",13,"bold"),bg="white")
year_label.grid(row=1,column=0,padx=10,sticky=W)
year_combo=ttk.Combobox(current_course_frame,textvariable=self.var_year,font=("time new roman",13,"bold"),state="readonly",width=20)
year_combo["values"]=("Select Year","1st","2nd","3rd","4th")
year_combo.current(0)
year_combo.grid(row=1,column=1,padx=2,pady=10,sticky=W)
#semester
semester_label=Label(current_course_frame,text="Semester",font=("time new roman",13,"bold"),bg="white")
semester_label.grid(row=1,column=2,padx=10,sticky=W)
semester_combo=ttk.Combobox(current_course_frame,textvariable=self.var_semester,font=("time new roman",13,"bold"),state="readonly",width=20)
semester_combo["values"]=("Select Semester","Ist","IInd","IIIrd","IVth","Vft","VIth","VIIth","VIIIth")
semester_combo.current(0)
semester_combo.grid(row=1,column=3,padx=2,pady=10,sticky=W)
#class student
class_student_frame=LabelFrame(Left_frame,bd=2,bg="white",relief=RIDGE,text="Class Student Information",font=("time new roman",12,"bold"))
class_student_frame.place(x=5,y=290,width=680,height=160)
#studentID
StudentID_label=Label(class_student_frame,text="Student ID:",font=("time new roman",13,"bold"),bg="white")
StudentID_label.grid(row=0,column=0,padx=10,pady=5,sticky=W)
StudentID_entry=ttk.Entry(class_student_frame,textvariable=self.var_std_id,width=20,font=("time new roman",13,"bold"))
StudentID_entry.grid(row=0,column=1,padx=10,pady=5,sticky=W)
#student NaME
StudentName_label=Label(class_student_frame,text="Student Name:",font=("time new roman",13,"bold"),bg="white")
StudentName_label.grid(row=0,column=2,padx=10,pady=5,sticky=W)
StudentName_entry=ttk.Entry(class_student_frame,textvariable=self.var_std_name,width=20,font=("time new roman",13,"bold"))
StudentName_entry.grid(row=0,column=3,padx=10,pady=5,sticky=W)
#class divison
class_div_label=Label(class_student_frame,text="Class Division:",font=("time new roman",13,"bold"),bg="white")
class_div_label.grid(row=1,column=0,padx=10,pady=5,sticky=W)
class_div_entry=ttk.Entry(class_student_frame,textvariable=self.var_div,width=20,font=("time new roman",13,"bold"))
class_div_entry.grid(row=1,column=1,padx=10,pady=5,sticky=W)
#Roll No
roll_no_label=Label(class_student_frame,text="Roll No:",font=("time new roman",13,"bold"),bg="white")
roll_no_label.grid(row=1,column=2,padx=10,pady=5,sticky=W)
roll_no_entry=ttk.Entry(class_student_frame,textvariable=self.var_roll,width=20,font=("time new roman",13,"bold"))
roll_no_entry.grid(row=1,column=3,padx=10,pady=5,sticky=W)
#radio btn
self.var_radio1=StringVar()
radiobtn1=ttk.Radiobutton(class_student_frame,textvariable=self.var_radio1,text="Take a Photo Sample",value="YES")
radiobtn1.grid(row=4,column=0)
self.var_radio2=StringVar()
radiobtn2=ttk.Radiobutton(class_student_frame,textvariable=self.var_radio2,text="NO Photo Sample",value="NO")
radiobtn2.grid(row=4,column=1)
# save btn
btn_frame=Frame(class_student_frame,bd=2,relief=RIDGE,bg="white")
btn_frame.place(x=0,y=100,width=675,height=30)
save_btn=Button(btn_frame,text="SAVE",command=self.add_data,width=15,font=("time new roman",13,"bold"),bg="red",fg="white")
save_btn.grid(row=0,column=0)
update_btn=Button(btn_frame,text="UPDATE",width=15,font=("time new roman",13,"bold"),bg="blue",fg="white")
update_btn.grid(row=0,column=1)
delete_btn=Button(btn_frame,text="DELETE",width=15,font=("time new roman",13,"bold"),bg="green",fg="white")
delete_btn.grid(row=0,column=2)
reset_btn=Button(btn_frame,text="RESET",width=18,font=("time new roman",13,"bold"),bg="light blue",fg="white")
reset_btn.grid(row=0,column=3)
# right side label frame
Right_frame=LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Student Details",font=("time new roman",12,"bold"))
Right_frame.place(x=740,y=10,width=600,height=490)
img_right=Image.open(r"C:\Users\ERATULDELHI\Desktop\face recogintion system\s6.png")
img_right=img_right.resize((700,130),Image.ANTIALIAS)
self.photoimg_right=ImageTk.PhotoImage(img_right)
f_lbl=Label(Right_frame,image=self.photoimg_right)
f_lbl.place(x=5,y=0,width=700,height=130)
# =============search system=============
search_frame=LabelFrame(Right_frame,bd=2,bg="white",relief=RIDGE,text="Search System",font=("time new roman",12,"bold"))
search_frame.place(x=5,y=135,width=583,height=70)
search_label=Label(search_frame,text="Search By:",font=("time new roman",15,"bold"),bg="dark blue",fg="white")
search_label.grid(row=0,column=0,padx=10,pady=5,sticky=W)
search_combo=ttk.Combobox(search_frame,font=("time new roman",12,"bold"),state="readonly",width=20)
search_combo["values"]=("Search","Roll_No","Phone_No")
search_combo.current(0)
search_combo.grid(row=0,column=1,padx=2,pady=10,sticky=W)
search_btn=Button(search_frame,text="SEARCH",width=10,font=("time new roman",12,"bold"),bg="dark blue",fg="white")
search_btn.grid(row=0,column=2,padx=4)
showall_btn=Button(search_frame,text="SHOW ALL",width=10,font=("time new roman",12,"bold"),bg="dark blue",fg="white")
showall_btn.grid(row=0,column=3,padx=4)
#table frame
table_frame=Frame(Right_frame,bd=2,bg="white",relief=RIDGE)
table_frame.place(x=5,y=210,width=583,height=250)
#scroll bars
scroll_x=ttk.Scrollbar(table_frame,orient=HORIZONTAL)
scroll_y=ttk.Scrollbar(table_frame,orient=VERTICAL)
self.student_table=ttk.Treeview(table_frame,columns=("dep","course","year","sem","id","name","div","roll no"),xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set)
scroll_x.pack(side=BOTTOM,fill=X)
scroll_y.pack(side=RIGHT,fill=Y)
scroll_x.config(command=self.student_table.xview)
scroll_y.config(command=self.student_table.yview)
self.student_table.heading("dep",text="Department")
self.student_table.heading("course",text="Course")
self.student_table.heading("year",text="Year")
self.student_table.heading("sem",text="Semester")
self.student_table.heading("id",text="StudentID")
self.student_table.heading("name",text="StudentName")
self.student_table.heading("div",text="Division")
self.student_table["show"]="headings"
self.student_table.column("dep",width=100)
self.student_table.column("course",width=100)
self.student_table.column("year",width=100)
self.student_table.column("sem",width=100)
self.student_table.column("id",width=100)
self.student_table.column("name",width=100)
self.student_table.column("div",width=100)
self.student_table.pack(fill=BOTH,expand=1)
# function declration
def add_data(self):
if self.var_dep.get()=="Select Department" or self.var_std_name.get()=="" or self.var_std_id.get()=="":
messagebox.showerror("Error","All fields are required",parent=self.root)
else:
messagebox.showinfo("Success","Welcome With ATUL DELHI")
if __name__== "__main__":
root=Tk()
obj=Student(root)
root.mainloop()

0 Comments
if you have any doubts.Please let me know.