Sei sulla pagina 1di 77

SCHOOL

MANAGEMENT
SYSTEM
FATEMA - XII
INDIA INTERNATIONAL SCHOOL
BONAFIDE CERTIFICATE

This is to certify this Computer Science project has been


completed by Miss
FATEMA
Student of class XII A
Under the supervision of
MRS. SHABANA FAISAL
Head of Computer Science Department

________________
Date of Submission
SUBMITTED FOR ALL INDIAN SENIOR SECONDARY EXAMINATION
(AISSE). IN COMPUTER SCIENCE AT INDIA INTERNATIONAL
SCHOOL, MANGAF, KUWAIT

_____________ ______________
Principal External Examiner
______________
Internal Examiner
ACKNOWLEDGMENT

Firstly, I would like to thank God for his blessings in


completing this Project.
Secondly, I express my special thanks to teacher
MRS. SHABANA FAISAL for her guidance and support
in completing my Project.
The completion of this Project could not have been
possible without the blessings of God, my parents
and support from my friends and teacher. I would
like to thank them all.

DATE: _____________ _____________________


(Name and signature of the
Student)
INDEX

S.NO CONTENT PAGE NO.

1
1. SOFTWARE
DESCRIPTION

2
2. PROJECT
REQUIREMENTS

3
3. WORK FLOW

4
4. DOCUMENTATION

15
5. SOURCE CODE

58
6. OUTPUT

73
7. BIBLOGRAPHY
SOFTWARE
DESCRIPTION
A School Management System is an assemblage
of computer guidance, created to manage the
day-to-day administrative task of school. Allows
the school to manage administrative operations
from a single platform, by increasing efficiency,
productivity and saving a lot of time.
From tracking the student and staff details in just
one search, to adding or updating the same, all
can be done in a matter of few minutes
seamlessly.
This program not only saves time but also
ensures the integrity of data as well as protects
the same.

1|Page
PROJECT
REQUIREMENTS

❖ Software requirements:
▪ Operating System: Windows 7-8-10
▪ Display settings 100%
▪ Screen Resolution – 1360x768
❖ Hardware requirement:
▪ Disk Space: Minimum - 1 GB

2|Page
WORKFLOW
REGISTRATION SIGN UP

HOMEPAGE
FORGET PASS

STUDENT

SAVE EDIT SEARCH

STAFF

SAVE EDIT SEARCH

EXAM

SAVE SEARCH

FEES

SAVE SEARCH

ATTENDANCE

SAVE SEARCH
LOGOUT 3|Page
DOCUMENTATION
MODULES USED:

▪ tkinter
▪ mysql.connector
▪ tkcalendar
▪ PIL
▪ sys

4|Page
BUILT-IN FUNCTIONS USED:

Tkinter Functions:

▪ Tk
▪ Title
▪ Geometry
▪ Configure
▪ Notebook
▪ Place
▪ Grid
▪ Pack
▪ Combobox
▪ DateEntry
▪ Resizable
▪ Label
▪ Entry
▪ Frame
▪ Button
▪ Messagebox
▪ Font
▪ Treeview
▪ Scrollbar

5|Page
Mysql.connector Functions:

▪ connect
▪ cursor
▪ execute
▪ fetchall
▪ commit
▪ close

TkCalendar Function:
▪ DateEntry

6|Page
USERS-DEFINED FUNCTIONS USED:

❖ Login
➢ Mys_query
➢ Registration_sys
➢ Register_data
➢ Login_sys
➢ Login_entry
➢ Forget_pass
• Fgtpass
❖Homepage
➢ mys_query
➢ Resize
➢ Home_screen
➢ Stud_window
➢ Save1
➢ Fetch_data1
➢ Update1_data
• Get
• Save
• Cancel
• Delete
➢ Search1

7|Page
➢ Staff_window
➢ Save2
➢ Fetch_data2
➢ Update_data2
• Get
• Save
• Cancel
• Delete
➢ Search2

➢ Exam_window
➢ calpercent
➢ save3
➢ new_frame
➢ fetch_data3
➢ search3

➢ Fee_window
➢ Save4
➢ new_frame

8|Page
➢ fetch_data4
➢ search4

➢ attendance_window
➢ Save5
➢ new_frame
➢ fetch_data5
➢ search5

9|Page
FILES USED:
➢Images
• "IMG1.png"
• "IMG2.png"
• "WhatsApp Image 2020-06-25 at
02.49.05 (1).jpeg"

10 | P a g e
MYSQL:

➢ Registration

11 | P a g e
➢ Student Management

➢ Staff Management

12 | P a g e
➢Exam

➢Fee

13 | P a g e
➢Attendance

14 | P a g e
➢ SOURCE CODE:
➢ Login System
1 from tkinter import *
2 from tkinter import messagebox , ttk
3 from tkinter import PhotoImage
4 from PIL import ImageTk
5 import mysql.connector as my
6
7 #=========Mysql query====================
8 def mys_query(query, tup):
9 my_con = my.connect(host='sql12.freemysqlhosting.net',user='sql1237120
10 6',
11 passwd='tmPj6XBlDK',database='sql12371206)
12 cur = my_con.cursor()
13 tup1 = ()
14 for i in tup:
15 tup1 = tup1 + (i.get(),)
16 cur.execute(query % tup1)
17 my_con.commit()
18 my_con.close()
19
20 #==============REGISTRATION WINDOW=====================
21 def registration_sys():
22 root1 = Tk()
23 root1 = root1
24 root1.title('REGISTRATION FORM')
25 root1.geometry("900x600+250+25")
26 img1=ImageTk.PhotoImage(file="IMG2.png")
27 label_img1=Label(root1,image=img1)
28 label_img1.place(x=0,y=0)
29 frame1=Frame(root1,bg="#d2b8b8")
30 frame1.place(x=100,y=100,width=700,height=400)
31
32
33 #==============================REGISTRATION FRAME======================
34 title=Label(frame1,text="REGISTRATION HERE",font=("Elephant",23,"bold"
35 )
36 ,bg="#d2b8b8",fg="black")
37 title.place(x=120,y=30)
38
39 name1=Label(frame1,text="Name :",font=("times new roman",15,"bold")
40 ,bg="#d2b8b8",fg="#6b625b")
41 name1.place(x=50 , y=100)

15 | P a g e
42 ent_name=Entry(frame1,font=("times new roman",15),bg="lightgray")
43 ent_name.place(x=50,y=130 , width= 250)
44
45 con1=Label(frame1,text="Contact Number :",font=("times new roman",15,
46 "bold"),bg="#d2b8b8",fg="#6b625b")
47 con1.place(x=370 , y=100)
48 ent_con=Entry(frame1,font=("times new roman",15),bg="lightgray")
49 ent_con.place(x=370,y=130 , width= 250)
50 password=Label(frame1,text="Password :",font=("times new roman",15,"bo
51 ld")
52 ,bg="#d2b8b8",fg="#6b625b")
53 password.place(x=50,y=170)
54 txt_pass=Entry(frame1,font=("times new roman",15),bg="lightgray")
55 txt_pass.place(x=50,y=200,width=250)
56
57 email1=Label(frame1,text="Email Address :",font=("times new roman",15,
58 "bold"),bg="#d2b8b8",fg="#6b625b")
59 email1.place(x=370 , y=170)
60 ent_email=Entry(frame1,font=("times new roman",15),bg="lightgray")
61 ent_email.place(x=370,y=200 ,width= 250)
62
63
64 sec_qus=Label(frame1,text="Security Questions",font=("times new roman",15,

65 "bold"),bg="#d2b8b8",fg="#6b625b")
66 sec_qus.place(x=50,y=240)
67 cmb_quest=ttk.Combobox(frame1,font=("times new roman",13),state='reado
68 nly'
69 ,justify=CENTER)
70 cmb_quest["values"]=("SELECT","Enter the Fax Number",
71 "Enter the Post Box Number")
72 cmb_quest.place(x=50,y=270,width=250)
73 cmb_quest.current(0)
74
75 answer=Label(frame1,text="Answer :",font=("times new roman",15,"bold")
76 ,bg="#d2b8b8",fg="#6b625b")
77 answer.place(x=370,y=240)
78 txt_ans=Entry(frame1,font=("times new roman",15),bg="lightgray")
79 txt_ans.place(x=370,y=270,width=250)
80
81 #==============REGISTER - FUNCTION===================
82 def register_data():
83 if ent_name.get()=="" or ent_con.get()==""or
84 txt_pass.get()==""or ent_email.get()=="" or cmb_quest.get()=="
85 "

16 | P a g e
86 or txt_ans.get()=="":
87 messagebox.showerror("ERROR!!","All the fields are required!",
88 parent=root1)
89 else:
90 tup = (ent_name,ent_con,txt_pass,ent_email,cmb_quest,txt_ans)
91 query = "insert into registration1 values ('%s','%s'," \
92 "'%s','%s','%s','%s')"
93 mys_query(query, tup)
94 for i in tup:
95 try:
96 i.set('')
97 except:
98 i.delete(0, END)
99 messagebox.showinfo("WELCOME","Register Successful",parent=roo
100 t1)
101
102 btn_regs=Button(frame1,text="REGISTER NOW",font=("times new roman",13,
103 "bold"),bg="#8a7b7c",cursor="hand2",command=register_data)
104 btn_regs.place(x=50,y=320,width=250)
105
106 #================SIGN UP======================
107 def login_sys():
108 root1.destroy()
109 root2 = Tk()
110 root2 = root2
111 root2.title('LOGIN SYSTEM')
112 root2.geometry("550x500+400+100")
113 img2=ImageTk.PhotoImage(file="IMG1.png")
114 label_img2=Label(root2,image=img2)
115 label_img2.place(x=0,y=0)
116 login_frame=Frame(root2,bd=0,bg="#d2b8b8")
117 login_frame.place(x=75,y=75,width=400,height=350)
118
119 #===========SIGN UP FRAME====================================
120 title=Label(login_frame,text="LOGIN SYSTEM",font=('Elephant',22)
121 ,bg="#d2b8b8",fg="black")
122 title.place(x=0,y=10,relwidth=1)
123
124 lbl_user=Label(login_frame,text="EMAIL ADDRESS",font=(
125 "times new roman",15,"bold"),bg="#d2b8b8",fg="#6b625b")
126 lbl_user.place(x=95,y=70)
127 txt_user=Entry(login_frame,font=("times new roman",15),bg="lightgr
128 ay")
129 txt_user.place(x=95,y=110)
130

17 | P a g e
131 lbl_pass=Label(login_frame,text="PASSWORD",font=("times new roman"
132 ,15,"bold"),bg="#d2b8b8",fg="#6b625b")
133 lbl_pass.place(x=95,y=150)
134 txt_pass=Entry(login_frame,show="*",font=("times new roman",15),
135 bg='lightgray')
136 txt_pass.place(x=95,y=190)
137
138 #===============SIGNUP FUNCTION============================
139 def loginentry():
140 if txt_user.get()=="" or txt_pass.get()=="":
141 messagebox.showerror("ERROR!!","All fields are requied!",
142 parent=root2)
143 else:
144 mycon = my.connect(host='sql12.freemysqlhosting.net',user=
145 'sql12371206',passwd='tmPj6XBlDK', database='sql123712
146 06')
147 cur = mycon.cursor()
148 cur.execute("select * from registration1 where email=%s an
149 d
150 password=%s",(txt_user.get(),txt_pass.get()))
151 row=cur.fetchone()
152
153 if row==None:
154 messagebox.showerror("ERROR!!",
155 "Invalid Email Address and Password",parent=root2)
156 else:
157 messagebox.showinfo("SUCCESS !!",
158 "WELCOME To School Management System",parent=root2
159 )
160 root2.destroy()
161 import SchoolManagementSystem
162 SchoolManagementSystem.home_screen()
163 mycon.close()
164
165 btn_login=Button(login_frame,text="LOGIN",font=("times new roman",
166 13
167 ,"bold"),bg="#8a7b7c",cursor="hand2",command=loginentry)
168 btn_login.place(x=95,y=250,height=35,width=200)
169
170 #===================FORGET PASS WINDOW=====================
171 def forget_pass():
172 root3=Toplevel()
173 root3.title('FORGET PASSWORD')
174 root3.geometry("350x360+500+175")
175 root3.configure(bg="#d2b8b8")

18 | P a g e
176 root3.focus_force()
177 root3.grab_set()
178
179 tilte2=Label(root3,text="FORGOT PASSWORD",font=('Elephant',17)
180 ,bg="#d2b8b8",fg="black")
181 tilte2.place(x=0,y=10,relwidth=1)
182
183 email=Label(root3,text='Email Address',font=("times new roman"
184 ,
185 13,"bold"),bg="#d2b8b8",fg="#6b625b")
186 email.place(x=50,y=50)
187 txt_email=Entry(root3,font=("times new roman",13),bg="lightgra
188 y")
189 txt_email.place(x=50,y=80,width=250)
190
191 sec_qus=Label(root3,text="Security Questions",font=(
192 "times new roman",13,"bold"),bg="#d2b8b8",fg="#6b625b")
193 sec_qus.place(x=50,y=110)
194 cmb_quest=ttk.Combobox(root3,font=("times new roman",13),
195 state='readonly',justify=CENTER)
196 cmb_quest["values"]=("SELECT","Enter the Fax Number",
197 "Enter the Post Box Number")
198 cmb_quest.place(x=50,y=140,width=250)
199 cmb_quest.current(0)
200
201 answer=Label(root3,text="Answer",font=("times new roman",
202 13,"bold"),bg="#d2b8b8",fg="#6b625b")
203 answer.place(x=50,y=170)
204 txt_ans=Entry(root3,font=("times new roman",13)
205 ,bg="lightgray")
206 txt_ans.place(x=50,y=200,width=250)
207
208 newpass=Label(root3,text="New Password",font=(
209 "times new roman",13,"bold"),bg="#d2b8b8",fg="#6b625b")
210 newpass.place(x=50,y=230)
211 txt_newpass=Entry(root3,font=("times new roman",13)
212 ,bg="lightgray")
213 txt_newpass.place(x=50,y=260,width=250)
214
215 #================FORGET PASS FUNCTION==================
216 def fgtpass():
217 if cmb_quest.get()=="Select" or txt_ans.get()=="" or
218 txt_newpass.get()=="":
219 messagebox.showerror("ERROR!!","All fields are require
220 d",

19 | P a g e
221 parent=root3)
222 else:
223 mycon = my.connect(host='sql12.freemysqlhosting.net',
224 user='sql12371206',passwd='tmPj6XBlDK',
225 database='sql12371206')
226 cur = mycon.cursor()
227 cur.execute("select*from registration1 where email=%s
228 \
229 and questions=%s and answer=%s",(txt_email.get(),
230 cmb_quest.get(),txt_ans.get()))
231 row=cur.fetchall()
232
233 if row==None:
234 messagebox.showerror("ERROR!!","Please enter the \
235 correct security question",parent=root3)
236 else:
237 cur.execute("update registration1 set password=%s\
238 where email=%s ",(txt_newpass.get(),
239 txt_email.get()))
240 messagebox.showinfo("SUCCESS",
241 "Your Password has been Updated
242 \n Please Login!",parent=root3)
243 mycon.commit()
244 mycon.close()
245 root3.destroy()
246
247 btn_reset=Button(root3,text="RESET PASSWORD",font=("times new\
248 roman",13,"bold"),bg="#8a7b7c",cursor="hand2",
249 command=fgtpass)
250 btn_reset.place(x=50,y=310,width=250)
251
252 btn_forget=Button(login_frame,text="FORGOT PASSWORD ?",bd=0,
253 font=("times new roman",13,"bold"),bg="#d2b8b8",activebackgrou
254 nd=
255 "#d2b8b8",cursor="hand2",command=forget_pass)
256 btn_forget.place(x=95,y=300,height=35,width=200)
257
258 root2.mainloop()
259
260 login_regs=Button(frame1,text="SIGN IN",font=("times \
261 new roman",13,"bold"),bg="#8a7b7c",cursor="hand2",command=login_sy
262 s)
263 login_regs.place(x=370,y=320,width=250)
264 root1.mainloop()
265 registration_sys()

20 | P a g e
Home Page
1 from tkinter import *
2 from tkinter import ttk
3 from PIL import Image, ImageTk
4 import tkcalendar
5 import mysql.connector as my
6 import sys
7
8 #===============Mys_query===================
9 def mys_query(query, tup):
10 my_con = my.connect(host='sql12.freemysqlhosting.net',
11 user='sql12371206', passwd='tmPj6XBlDK',database='sql12371206')
12 cur = my_con.cursor()
13 tup1 = ()
14 for i in tup:
15 tup1 = tup1 + (i.get(),)
16 cur.execute(query % tup1)
17 my_con.commit()
18 my_con.close()
19
20 #====================RESIZE================
21 def resize(event):
22 new_width = event.width
23 new_height = event.height
24 img = copy_of_image.resize((new_width, new_height))
25 photo = ImageTk.PhotoImage(img)
26 label1.config(image=photo)
27 label1.image = photo
28
29 #=============================HomeScreen=============================
30 def home_screen():
31 global copy_of_image
32 global label1
33 root = Tk()
34 root = root
35 root.title('SCHOOL MANAGEMENT SYSTEM')
36 root.geometry("1360x786+0+0")
37 root.state("zoomed")
38 image1 = Image.open("WhatsApp Image 2020-06-25\
39 at 02.49.05 (1).jpeg")
40 copy_of_image = image1.copy()
41 bg = ImageTk.PhotoImage(image1)

21 | P a g e
42 label1 = Label(root, image=bg)
43 label1.bind('<Configure>', resize)
44 label1.place(relx=0.0, rely=0.0, relheight=1.0,
45 relwidth=1.0)
46 label1.image = bg
47
48 lbl_logout = Button(root,text='L\nO\nG\nO\nU\nT',
49 command=lambda:sys.exit(),relief=RIDGE,bd=0,font=
50 ("times new roman", 13), bg="#a48a73", fg='#203c48')
51 lbl_logout.place(x=1252, y=25)
52
53 #=====================STUDENT MANAGEMENT WINDOW===================
54 def stud_window():
55 stud_frame = LabelFrame(root,text='STUDENT MANAGEMENT SYSTEM')
56 stud_frame.configure(bg="#e4dacb")
57 stud_frame.place(x=100, y=190, width=1170, height=485)
58 nb = ttk.Notebook(stud_frame)
59 nb.grid()
60
61 frm1 = Frame(nb, width=1160, height=437, bg="#e4dacb")
62 frm1.grid(row=0, column=0)
63 nb.add(frm1, text="ADMISSION")
64
65 frm2 = Frame(nb, width=1160, height=437, bg="#e4dacb")
66 frm2.grid(row=0, column=1)
67 nb.add(frm2, text="SEARCH")
68
69 # ===================STUDENT FRAME==========================
70 adno1_lbl = Label(frm1, text="ADMISSION NUMBER",font=("times\
71 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
72 adno1_lbl.grid(row=0, column=0, pady=10, padx=25, sticky="w")
73 adno1_ent = Entry(frm1, width=15,font=("times new roman", 13),
74 bd=2,relief=GROOVE)
75 adno1_ent.grid(row=0, column=1, pady=10, padx=0, sticky="w")
76
77 firstname1_lbl = Label(frm1, text="FIRST NAME",font=("times \
78 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
79 firstname1_lbl.grid(row=1, column=0, pady=10, padx=25,sticky="w")
80 firstname1_ent = Entry(frm1, width=15,font=("times new roman",
81 13), bd=2,relief=GROOVE)
82 firstname1_ent.grid(row=1, column=1, pady=10, padx=0,sticky="w")
83
84 fathersname1_lbl = Label(frm1, text="FATHER'S NAME",font=("times \
85 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")

22 | P a g e
86 fathersname1_lbl.grid(row=2, column=0, pady=10, padx=25,sticky="w"
87 )
88 fathersname1_ent = Entry(frm1, width=15,font=("times new roman", 1
89 3),
90 bd=2,relief=GROOVE)
91 fathersname1_ent.grid(row=2, column=1, pady=10, padx=0,sticky="w")
92
93 fathersoccupation1_lbl = Label(frm1, text="FATHER'S OCCUP.",font=
94 ("times new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
95 fathersoccupation1_lbl.grid(row=3, column=0, pady=10, padx=25,
96 sticky="w")
97 combo_fathersocc1 = ttk.Combobox(frm1, width=13,text="Choose\
98 Occupation",font=("times new roman", 13), state='readonly')
99 combo_fathersocc1["values"] = ( "Business", "Service", "Doctor",
100 "Engineer","Other")
101 combo_fathersocc1.grid(row=3, column=1, padx=0, pady=10,sticky='w'
102 )
103
104 dob1_lbl = Label(frm1, text="DOB",font=("times new roman", 15, 'bo
105 ld')
106 ,bg="#e4dacb",fg="#072746")
107 dob1_lbl.grid(row=4, column=0, pady=10, padx=25, sticky="w")
108 dob1_ent = tkcalendar.DateEntry(frm1, width=13,font=("times \
109 new roman", 13),relief=GROOVE)
110 dob1_ent.delete(0, END)
111 dob1_ent.grid(row=4, column=1, pady=10, padx=0, sticky="w")
112
113 class1_lbl = Label(frm1, text="CLASS",font=("times new roman",
114 15, 'bold'),bg="#e4dacb",fg="#072746")
115 class1_lbl.grid(row=5, column=0, pady=10, padx=25, sticky="w")
116 combo_class1 = ttk.Combobox(frm1, width=13, text="class",font=
117 ("times new roman", 13),state='readonly')
118 combo_class1["values"] = ("XI", "XII")
119 combo_class1.grid(row=5, column=1, padx=0, pady=10,sticky='w')
120
121 course1_lbl = Label(frm1, text="COURSE",font=("times new roman",
122 15, 'bold'),bg="#e4dacb",fg="#072746")
123 course1_lbl.grid(row=6, column=0, pady=10, padx=25,sticky="w")
124 combo_course1 = ttk.Combobox(frm1, width=13,text="ChooseCourse_",
125 font=("times new roman", 13),state='readonly')
126 combo_course1["values"] = ("PCMB", "PCB + PE", "PCM + ECO",
127 "PCB + INFO", "PCM + COMP")
128 combo_course1.grid(row=6, column=1, padx=0, pady=10,sticky='w')
129
130 phone1_lbl = Label(frm1, text="PHONE NUMBER",font=("times\

23 | P a g e
131 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
132 phone1_lbl.grid(row=7, column=0, pady=10, padx=25, sticky="w")
133 phone1_ent = Entry(frm1, width=15,font=("times new roman",
134 13), bd=2,relief=GROOVE)
135 phone1_ent.grid(row=7, column=1, pady=10, padx=0, sticky="w")
136
137 gender1_lbl = Label(frm1, text="GENDER",font=("times new roman",
138 15, 'bold'),bg="#e4dacb",fg="#072746")
139 gender1_lbl.grid(row=8, column=0, pady=10, padx=25,sticky="w")
140 combo_gender1 = ttk.Combobox(frm1, width=13, text="GENDER",font=
141 ("times new roman", 13),state='readonly')
142 combo_gender1["values"] = ("MALE", "FEMALE")
143 combo_gender1.grid(row=8, column=1, padx=0, sticky='w')
144
145 address1_lbl = Label(frm1, text="ADDRESS",font=("times new roman",
146 15, 'bold'),bg="#e4dacb",fg="#072746")
147 address1_lbl.grid(row=0, column=2, pady=10, padx=25,sticky="w")
148 txt_address1 = Entry(frm1, width=15,font=("times new roman", 13))
149 txt_address1.grid(row=0, column=3, pady=10, padx=0,sticky="w")
150
151 lastname1_lbl = Label(frm1, text="LAST NAME",font=("times new roma
152 n",
153 15, 'bold'),bg="#e4dacb",fg="#072746")
154 lastname1_lbl.grid(row=1, column=2, pady=10, padx=25,sticky="w")
155 lastname1_ent = Entry(frm1, width=15,font=("times new roman", 13),
156 bd=2,relief=GROOVE)
157 lastname1_ent.grid(row=1, column=3, pady=10, padx=0,sticky="w")
158
159 mothersname1_lbl = Label(frm1, text="MOTHER'S NAME", font=("times\
160 new roman", 15, 'bold'), bg="#e4dacb", fg="#072746")
161 mothersname1_lbl.grid(row=2, column=2, pady=10, padx=25,sticky="w"
162 )
163 mothersname1_ent = Entry(frm1, width=15,font=("times new roman", 1
164 3),
165 bd=2,relief=GROOVE)
166 mothersname1_ent.grid(row=2, column=3, pady=10, padx=0,sticky="w")
167
168 mothersoccupation1_lbl = Label(frm1, text="MOTHER'S OCCUP.",font=
169 ("times new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
170 mothersoccupation1_lbl.grid(row=3, column=2, pady=10, padx=25,
171 sticky="w")
172 combo_mothersocc1 = ttk.Combobox(frm1, width=13,text="Choose\
173 Occupation",
174 font=("times new roman", 13), state='readonly')

24 | P a g e
175 combo_mothersocc1["values"] = ("House Wife", "Business", "Service"
176 ,
177 "Doctor", "Engineer","Other")
178 combo_mothersocc1.grid(row=3, column=3, padx=0, pady=10,sticky='w'
179 )
180
181 ad1_date_lbl = Label(frm1, text="ADMISSION DATE",font=("times \
182 new roman", 15, 'bold'), bg="#e4dacb",fg="#072746")
183 ad1_date_lbl.grid(row=4, column=2, pady=10, padx=25,sticky="w")
184 ad1_date_ent = tkcalendar.DateEntry(frm1, width=13, font=("times\
185 new roman", 13), relief=GROOVE)
186 ad1_date_ent.delete(0, END)
187 ad1_date_ent.grid(row=4, column=3, pady=10, sticky="w")
188
189 section1_lbl = Label(frm1, text="SECTION",font=("times new\
190 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
191 section1_lbl.grid(row=5, column=2, pady=10, padx=25,
192 sticky="w")
193 combo_section1 = ttk.Combobox(frm1, width=13, text="section",
194 font=("times new roman", 13), state='readonly')
195 combo_section1["values"] = ("A", "B", "C", "D")
196 combo_section1.grid(row=5, column=3, padx=0, pady=10,sticky='w')
197
198 landline1_lbl = Label(frm1, text="LANDLINE NUMBER",font=("times\
199 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
200 landline1_lbl.grid(row=6, column=2, pady=10, padx=25,sticky="w")
201 landline1_ent = Entry(frm1, width=15,font=("times new roman", 13)
202 , bd=2,relief=GROOVE)
203 landline1_ent.grid(row=6, column=3, pady=10, padx=0,sticky="w")
204
205 religion1_lbl = Label(frm1, text="RELIGION",font=("times\
206 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
207 religion1_lbl.grid(row=7, column=2, pady=10, padx=25,sticky="w")
208 combo_religion1 = ttk.Combobox(frm1, width=13,text="Choose\
209 RELIGION",font=("times new roman", 13),state='readonly')
210 combo_religion1["values"] = ("ISLAM", "HINDUISM", "CHRISTIANITY"
211 , "BUDDHISM", "OTHER")
212 combo_religion1.grid(row=7, column=3, padx=0, pady=10,sticky='w')
213
214 bloodgrp1_lbl = Label(frm1, text="BLOOD GROUP",font=("times\
215 new roman", 15, 'bold'), bg="#e4dacb",fg="#072746")
216 bloodgrp1_lbl.grid(row=8, column=2, pady=10, padx=25,sticky="w")
217 combo_bloodgrp1 = ttk.Combobox(frm1, width=13,text="bloodGROUP",
218 font=("times new roman", 13),state='readonly')
219 combo_bloodgrp1["values"] = ( "A+", "B+", "O+", "AB+",

25 | P a g e
220 "A-", "B-", "O-", "AB-")
221 combo_bloodgrp1.grid(row=8, column=3, padx=0, pady=10,sticky='w')
222
223 #================STUDEMT FUNCTION========================
224 def save1():
225 tup = (adno1_ent, firstname1_ent, fathersname1_ent,
226 combo_fathersocc1,dob1_ent, combo_course1,phone1_ent,
227 combo_gender1, txt_address1, ad1_date_ent,lastname1_ent,
228 mothersname1_ent, combo_mothersocc1,combo_class1,
229 combo_section1,
230 landline1_ent,combo_religion1, combo_bloodgrp1)
231 query = "insert into stud_management values ('%s','%s'," \
232 "'%s','%s','%s','%s','%s','%s','%s'," \
233 "'%s','%s','%s'," \
234 "'%s','%s','%s','%s','%s','%s')"
235 mys_query(query, tup)
236 for i in tup:
237 try:
238 i.set('')
239 except:
240 i.delete(0, END)
241
242 def fetch_data1():
243 my_con1 = my.connect(host='sql12.freemysqlhosting.net',
244 user='sql12371206',passwd='tmPj6XBlDK', database='sql1237120
245 6')
246 cur = my_con1.cursor()
247 cur.execute("select * from stud_management")
248 rows = cur.fetchall()
249 if len(rows) != 0:
250 student_table.delete(*student_table.get_children())
251 for row in rows:
252 student_table.insert("", END, values=row)
253 my_con1.commit()
254 my_con1.close()
255
256 def update1_data():
257 my_con2 = my.connect(host='sql12.freemysqlhosting.net',
258 user='sql12371206',passwd='tmPj6XBlDK', database='sql1237120
259 6')
260 cur = my_con2.cursor()
261 query = 'select ad_no from stud_management'
262 cur.execute(query)
263 data = cur.fetchall()
264 tu = ()

26 | P a g e
265 for i in data:
266 tu = tu + i
267 adno1_ent.destroy()
268
269 #===========UPDATE FUNCTION=============
270 def get(event):
271 ad_no = combo_ad.get()
272 my_con3 = my.connect(host='sql12.freemysqlhosting.net',
273 user='sql12371206',passwd='tmPj6XBlDK',database='sql123712
274 06')
275 cur3 = my_con3.cursor()
276 query3 = 'Select first_name, fathers_name, ' \
277 'fathers_occup, dob, course, phone_no,' \
278 ' gender, address_text,' \
279 ' ad_date,' \
280 'last_name, mothers_name, mothers_occup, ' \
281 'class_, section, landline, religion,' \
282 ' blood_grp' \
283 ' from stud_management where ad_no = "%s" '\
284 % ad_no
285 cur3.execute(query3)
286 data3 = cur3.fetchall()
287 my_con3.close()
288 tup = (firstname1_ent, fathersname1_ent, combo_fathersocc1
289 ,
290 dob1_ent,combo_course1, phone1_ent,combo_gender1,
291 txt_address1, ad1_date_ent,lastname1_ent, mothersname1_e
292 nt,
293 combo_mothersocc1,combo_class1, combo_section1,
294 landline1_ent,combo_religion1,combo_bloodgrp1)
295 info = data3[0]
296 n = len(info)
297 for i in tup:
298 try:
299 i.set('')
300 except:
301 i.delete(0, END)
302
303 for i in range(n):
304 try:
305 tup[i].set(info[i])
306 except:
307 tup[i].insert(0, info[i])
308

27 | P a g e
309 combo_ad = ttk.Combobox(frm1, width=13,font=("times new roman"
310 ,
311 13),state='readonly')
312 combo_ad['values'] = tu
313 combo_ad.bind('<<ComboboxSelected>>', get)
314 combo_ad.grid(row=0, column=1, pady=10, padx=0,sticky="w")
315 my_con2.close()
316
317 def save():
318 tup = (firstname1_ent, fathersname1_ent, combo_fathersocc1
319 ,
320 dob1_ent, combo_course1,phone1_ent,combo_gender1,txt_addre
321 ss1,
322 ad1_date_ent,lastname1_ent,mothersname1_ent,combo_motherso
323 cc1,
324 combo_class1, combo_section1, landline1_ent,
325 combo_religion1, combo_bloodgrp1, combo_ad)
326 query = "update stud_management set " \
327 "first_name='%s',fathers_name='%s'," \
328 "fathers_occup='%s', dob='%s'," \
329 "course='%s',phone_no='%s', gender='%s'," \
330 "address_text='%s',ad_date='%s'," \
331 "last_name='%s', " \
332 "mothers_name='%s', mothers_occup='%s'," \
333 " class_='%s',section='%s',landline='%s'," \
334 "religion='%s'," \
335 "blood_grp='%s' where ad_no='%s'"
336
337 mys_query(query, tup)
338 for i in tup:
339 try:
340 i.set('')
341 except:
342 i.delete(0, END)
343
344 fetch_data1()
345
346 save1_btn.config(command=save)
347 update1_btn.destroy()
348
349 def cancel():
350 tup = (combo_ad, firstname1_ent,fathersname1_ent,
351 combo_fathersocc1,dob1_ent,combo_course1,
352 phone1_ent,
353 combo_gender1,txt_address1,ad1_date_ent,

28 | P a g e
354 lastname1_ent, mothersname1_ent,
355 combo_mothersocc1,
356 combo_class1, combo_section1, landline1_ent,
357 combo_religion1, combo_bloodgrp1)
358 for i in tup:
359 try:
360 i.set('')
361 except:
362 i.delete(0, END)
363 stud_window()
364 cancel_btn = Button(option_subframe, width=20,text='CANCEL",
365 bg="#072746",fg="white", command=cancel)
366 cancel_btn.place(x=50, y=155)
367
368 def delete():
369 mycon = my.connect(host='sql12.freemysqlhosting.net',
370 user='sql12371206',passwd='tmPj6XBlDK',database='sql123712
371 06')
372 cur = mycon.cursor()
373 main_adno = combo_ad.get()
374
375 query = "delete from stud_management where ad_no='%s'" %
376 (main_adno)
377 cur.execute(query)
378 mycon.commit()
379 query1 = "select * from stud_management"
380 cur.execute(query1)
381 data = cur.fetchall()
382 for row in student_table.get_children():
383 student_table.delete(row)
384 for row in data:
385 student_table.insert('', 'end', value=row)
386 mycon.close()
387 tup = (firstname1_ent, fathersname1_ent, combo_fathersocc1
388 ,
389 dob1_ent, combo_course1, phone1_ent,combo_gender1,
390 txt_address1, ad1_date_ent,lastname1_ent, mothersname1_ent
391 ,
392 combo_mothersocc1,combo_class1, combo_section1,landline1_e
393 nt,
394 combo_religion1, combo_bloodgrp1, combo_ad)
395 for i in tup:
396 try:
397 i.set('')
398 except:

29 | P a g e
399 i.delete(0, END)
400 stud_window()
401
402 delete_btn = Button(option_subframe, width=20,text='DELETE',
403 bg="#072746", fg="white", command=delete)
404 delete_btn.place(x=50, y=205)
405
406 option_subframe = Frame(frm1, bd=2, relief=FLAT, bg="#e4dacb")
407 option_subframe.place(x=900, y=50, width=250, height=400)
408 save1_btn = Button(option_subframe, width=20, text='SAVE',
409 bg="#072746", fg="white", command=save1)
410 save1_btn.place(x=50, y=105)
411 update1_btn = Button(option_subframe, width=20, text='EDIT',
412 bg="#072746", fg="white",command=update1_data)
413 update1_btn.place(x=50, y=155)
414
415 #============SEARCH BAR==============================
416 def search1():
417 mycon = my.connect(host='sql12.freemysqlhosting.net',
418 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
419 )
420 cur = mycon.cursor()
421 val = txt_search1.get()
422 value = '%' + str(val) + '%'
423 tup1 = (value, value, value, value, value, value, value, value
424 ,
425 value,value,value, value, value, value,value, value, value, va
426 lue)
427 query = "select*from stud_management where ad_no like ('%s')\
428 or first_name like ('%s') " \
429 "or fathers_name like ('%s') or fathers_occup like ('%
430 s')\
431 or dob like ('%s') " \
432 "or course like ('%s') or\
433 phone_no like ('%s') " \
434 "or gender like ('%s') or address_text like ('%s') "
435 \
436 "or ad_date like ('%s') or last_name like ('%s') or \
437 mothers_name like ('%s') " \
438 "or mothers_occup like ('%s') or class_ like ('%s')\
439 or section like ('%s')" \
440 "or landline like ('%s') or religion like ('%s')\
441 or blood_grp like ('%s') " % tup1
442
443 cur.execute(query)

30 | P a g e
444 data = cur.fetchall()
445
446 for row in student_table.get_children():
447 student_table.delete(row)
448 for row in data:
449 student_table.insert('', 'end', value=row)
450 mycon.commit()
451 mycon.close()
452
453 txt_search1 = Entry(frm2, width=50,font=("times new roman", \
454 12, 'bold'),bd=5, relief=GROOVE)
455 txt_search1.place(x=300, y=15)
456
457 search1_btn = Button(frm2,height=1,width=15,text='SEARCH',bg=
458 "#072746",fg="white",command=search1,
459 font=("times new roman",12,'bold'))
460 search1_btn.place(x=750, y=15)
461
462 table1_frame = Frame(frm2, bd=4, relief=RIDGE, bg='#fecea8')
463 table1_frame.place(x=10, y=70, width=1140, height=350)
464
465 scroll_x1 = Scrollbar(table1_frame, orient=HORIZONTAL)
466 scroll_y1 = Scrollbar(table1_frame, orient=VERTICAL)
467 student_table =ttk.Treeview(table1_frame,columns=("ADMISSION NUMBE
468 R",\
469 "FIRST NAME","FATHER'S NAME","FATHER'S OCCUP.", "DOB", "COURS
470 E",\
471 "PHONE NUMBER","GENDER", "ADDRESS", "ADMISSION DATE","LAST NA
472 ME",
473 "MOTHER'S NAME", "MOTHER'S OCCUP.", "CLASS", "SECTION",\
474 "LANDLINE NUMBER", "RELIGION", "BLOOD GROUP"),
475 xscrollcommand=scroll_x1.set,yscrollcommand=scroll_y1.set)
476 scroll_x1.pack(side=BOTTOM, fill=X)
477 scroll_y1.pack(side=RIGHT, fill=Y)
478 scroll_x1.config(command=student_table.xview)
479 scroll_y1.config(command=student_table.yview)
480 student_table.heading("ADMISSION NUMBER",text="ADMISSION NUMBER")
481 student_table.heading("FIRST NAME", text="FIRST NAME")
482 student_table.heading("FATHER'S NAME", text="FATHER'S NAME")
483 student_table.heading("FATHER'S OCCUP.",text="FATHER'S OCCUP.")
484 student_table.heading("DOB", text="DOB")
485 student_table.heading("COURSE", text="COURSE")
486 student_table.heading("PHONE NUMBER", text="PHONE NUMBER")
487 student_table.heading("GENDER", text="GENDER")
488 student_table.heading("ADDRESS", text="ADDRESS")

31 | P a g e
489 student_table.heading("ADMISSION DATE", text="ADMISSION DATE")
490 student_table.heading("LAST NAME", text="LAST NAME")
491 student_table.heading("MOTHER'S NAME", text="MOTHER'S NAME")
492 student_table.heading("MOTHER'S OCCUP.",text="MOTHER'S OCCUP.")
493 student_table.heading("CLASS", text="CLASS")
494 student_table.heading("SECTION", text="SECTION")
495 student_table.heading("LANDLINE NUMBER", text="LANDLINE NUMBER")
496 student_table.heading("RELIGION", text="RELIGION")
497 student_table.heading("BLOOD GROUP", text="BLOOD GROUP")
498
499 student_table["show"] = "headings"
500 student_table.column("ADMISSION NUMBER", width=150)
501 student_table.column("FIRST NAME", width=100)
502 student_table.column("FATHER'S NAME", width=100)
503 student_table.column("FATHER'S OCCUP.", width=120)
504 student_table.column("DOB", width=80)
505 student_table.column("COURSE", width=100)
506 student_table.column("PHONE NUMBER", width=120)
507 student_table.column("GENDER", width=80)
508 student_table.column("ADDRESS", width=80)
509 student_table.column("ADMISSION DATE", width=120)
510 student_table.column("LAST NAME", width=100)
511 student_table.column("MOTHER'S NAME", width=110)
512 student_table.column("MOTHER'S OCCUP.", width=120)
513 student_table.column("CLASS", width=50)
514 student_table.column("SECTION", width=90)
515 student_table.column("LANDLINE NUMBER", width=150)
516 student_table.column("RELIGION", width=80)
517 student_table.column("BLOOD GROUP", width=100)
518 student_table.pack(fill=BOTH, expand=1)
519 fetch_data1()
520
521 #==================STAFF MANAGEMENT WINDOW===========================
522 def staff_window():
523 staff_frame = LabelFrame(root, text='STAFF MANAGEMENT SYSTEM')
524
525 staff_frame.configure(bg="#e4dacb")
526 staff_frame.place(x=100, y=190, width=1170, height=485)
527
528 nb = ttk.Notebook(staff_frame)
529 nb.grid()
530 frm1 = Frame(nb, width=1160, height=437, bg="#e4dacb")
531 frm1.grid(row=0, column=0)
532 nb.add(frm1, text="ADMISSION")
533

32 | P a g e
534 frm2 = Frame(nb, width=1160, height=437, bg="#e4dacb")
535 frm2.grid(row=0, column=1)
536 nb.add(frm2, text="SEARCH")
537 #==========================STAFF FRAME===================
538 staffid_lbl = Label(frm1, text="STAFF ID",font=("times new \
539 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
540 staffid_lbl.grid(row=0, column=0, pady=10, padx=50,sticky="w")
541 staffid_ent = Entry(frm1, width=15,font=("times new roman", 13),
542 bd=2,relief=GROOVE)
543 staffid_ent.grid(row=0, column=1, pady=10, padx=0, sticky="w")
544
545 firstname2_lbl =Label(frm1, text="FIRST NAME",font=("times new rom
546 an",
547 15, 'bold'),bg="#e4dacb",fg="#072746")
548 firstname2_lbl.grid(row=1, column=0, pady=10, padx=50,sticky="w")
549 firstname2_ent = Entry(frm1, width=15,font=("times new roman", 13)
550 ,
551 bd=2,relief=GROOVE)
552 firstname2_ent.grid(row=1, column=1, pady=10, padx=0,sticky="w")
553
554 qualif1_lbl = Label(frm1,text="QUALIFICATION",font=("times new rom
555 an",
556 15, 'bold'),bg="#e4dacb",fg="#072746")
557 qualif1_lbl.grid(row=2, column=0, pady=10, padx=50, sticky="w")
558 qualif1_ent = Entry(frm1, width=15,font=("times new roman", 13),
559 bd=2,relief=GROOVE)
560 qualif1_ent.grid(row=2, column=1, pady=10, padx=0, sticky="w")
561
562 sub_dep_lbl = Label(frm1, text="SUB/DEP",font=("times new roman",
563 15, 'bold'),bg="#e4dacb",fg="#072746")
564 sub_dep_lbl.grid(row=3, column=0, pady=10, padx=50,sticky="w")
565 combo_sub_dep = ttk.Combobox(frm1, width=13,text="Choose sub/dep",
566 font=("times new roman", 13),state='readonly')
567 combo_sub_dep["values"] = ("Physics", "Chemistry", "Math","Biology
568 ",
569 "P.E", "Economics",
570 "Computer", "Infomatics", "IT", "Clerk"
571 ,
572 "Receptionist")
573 combo_sub_dep.grid(row=3, column=1, pady=10)
574
575 dob2_lbl = Label(frm1, text="DOB",font=("times new roman",15,'bold
576 '),
577 bg="#e4dacb",fg="#072746")
578 dob2_lbl.grid(row=4, column=0, pady=10, padx=50, sticky="w")

33 | P a g e
579 dob2_ent =tkcalendar.DateEntry(frm1, width=13,font=("times new rom
580 an",
581 13),relief=GROOVE)
582 dob2_ent.delete(0, END)
583 dob2_ent.grid(row=4, column=1, pady=10, padx=0, sticky="w")
584
585 sal_lbl=Label(frm1,text="SALARY",font=("times new roman", 15,'bold
586 '),
587 bg="#e4dacb",fg="#072746")
588 sal_lbl.grid(row=5, column=0, pady=10, padx=50, sticky="w")
589 sal_ent = Entry(frm1, width=15, font=("times new roman", 13),bd=2,
590 relief=GROOVE)
591 sal_ent.grid(row=5, column=1, pady=10, sticky="w")
592
593 phone2_lbl = Label(frm1, text="PHONE NUMBER",font=("times new roma
594 n",
595 15, 'bold'),bg="#e4dacb",fg="#072746")
596 phone2_lbl.grid(row=6, column=0, pady=10, padx=50, sticky="w")
597 phone2_ent = Entry(frm1, width=15,font=("times new roman", 13),
598 bd=2,relief=GROOVE)
599 phone2_ent.grid(row=6, column=1, pady=10, padx=0, sticky="w")
600
601 gender1_lbl = Label(frm1, text="GENDER",font=("times new roman",
602 15, 'bold'),bg="#e4dacb",fg="#072746")
603 gender1_lbl.grid(row=7, column=0, pady=10, padx=50,sticky="w")
604 combo_gender2 = ttk.Combobox(frm1, width=13, text="GENDER",
605 font=("times new roman", 13),state='readonly')
606 combo_gender2["values"] = ("Male", "Female")
607 combo_gender2.grid(row=7, column=1, padx=0, sticky='w')
608
609 address2_lbl = Label(frm1, text="ADDRESS",font=("times new roman",
610
611 15,'bold'),bg="#e4dacb",fg="#072746")
612 address2_lbl.grid(row=0, column=2, pady=10, padx=50,sticky="w")
613 txt_address2 = Entry(frm1, width=15,font=("times new roman", 13))
614 txt_address2.grid(row=0, column=3, pady=10, padx=0, sticky="w")
615
616 lastname2_lbl = Label(frm1, text="LAST NAME",font=("times new roma
617 n",
618 15, 'bold'),bg="#e4dacb",fg="#072746")
619 lastname2_lbl.grid(row=1, column=2, pady=10, padx=50,sticky="w")
620 lastname2_ent = Entry(frm1, width=15,font=("times new roman", 13),
621 bd=2,relief=GROOVE)
622 lastname2_ent.grid(row=1,column=3, pady=10, padx=0,sticky="w")
623

34 | P a g e
624 course2_lbl=Label(frm1,text="COURSE",font=("times new roman",15,
625 'bold'),bg="#e4dacb",fg="#072746")
626 course2_lbl.grid(row=2, column=2, pady=10, padx=50,sticky="w")
627 combo_course2 = ttk.Combobox(frm1, width=13,text="ChooseCourse",
628 font=("times new roman", 13),state='readonly')
629 combo_course2["values"] =("BBA","BCA","Btech","MBA","MTech","Other
630 ")
631 combo_course2.grid(row=2, column=3, padx=0, pady=10)
632
633 email_lbl =Label(frm1,text="EMAIL",font=("times new roman",15,'bol
634 d'),
635 bg="#e4dacb",fg="#072746")
636 email_lbl.grid(row=3, column=2, pady=10, padx=50, sticky="w")
637 email_ent=Entry(frm1,width=15,font=("times new roman",13),
638 bd=2,relief=GROOVE)
639 email_ent.grid(row=3, column=3, pady=10, sticky="w")
640
641 join_date_lbl=Label(frm1,text="DATE OF JOINING",font=("times\
642 new roman",15, 'bold'),bg="#e4dacb",fg="#072746")
643 join_date_lbl.grid(row=4, column=2, pady=10, padx=50,sticky="w")
644 join_date_ent = tkcalendar.DateEntry(frm1, width=13, font=("times\
645 new roman", 13), relief=GROOVE)
646 join_date_ent.delete(0, END)
647 join_date_ent.grid(row=4, column=3, pady=10, sticky="w")
648
649 religion2_lbl = Label(frm1, text="RELIGION",font=("times new roman
650 ",
651 15, 'bold'),bg="#e4dacb",fg="#072746")
652 religion2_lbl.grid(row=5, column=2, pady=10, padx=50,sticky="w")
653 combo_religion2 = ttk.Combobox(frm1, width=13,text="ChooseRELIGION
654 ",
655 font=("times new roman", 13),state='readonly')
656 combo_religion2["values"] = ("Islam", "Hinduism", "Christanity",
657 "Buddhism", "Other")
658 combo_religion2.grid(row=5, column=3, padx=0, pady=10)
659
660 landline2_lbl = Label(frm1, text="LANDLINE NUMBER",font=("times\
661 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
662 landline2_lbl.grid(row=6, column=2, pady=10, padx=50,sticky="w")
663 landline2_ent = Entry(frm1, width=15,font=("times new roman",13),
664 bd=2,relief=GROOVE)
665 landline2_ent.grid(row=6, column=3, pady=10, padx=0,sticky="w")
666
667 bloodgrp2_lbl = Label(frm1, text="BLOOD GROUP",font=("times new\
668 roman", 15, 'bold'), bg="#e4dacb",fg="#072746")

35 | P a g e
669 bloodgrp2_lbl.grid(row=7, column=2, pady=10, padx=50,sticky="w")
670 combo_bloodgrp2 = ttk.Combobox(frm1, width=13,text="bloodGROUP",
671 font=("times new roman", 13),state='readonly')
672 combo_bloodgrp2["values"] = ("A+", "B+", "O+", "AB+", "A-",
673 "B-", "O-", "AB-")
674 combo_bloodgrp2.grid(row=7, column=3, padx=0, pady=10,sticky='w')
675
676 def save2():
677 tup = (
678 staffid_ent, firstname2_ent, qualif1_ent, combo_sub_dep,
679 dob2_ent, join_date_ent, phone2_ent,combo_gender2,
680 txt_address2, lastname2_ent, combo_course2,
681 email_ent,sal_ent,combo_religion2,landline2_ent,combo_bloodgrp
682 2)
683 query = "insert into staff_management values ('%s','%s','%s',\
684 '%s','%s','%s','%s','%s','%s','%s','%s','%s'," \
685 "'%s','%s','%s','%s')"
686 mys_query(query, tup)
687
688 for i in tup:
689 try:
690 i.set('')
691 except:
692 i.delete(0, END)
693
694 def fetch_data2():
695 mycon = my.connect(host='sql12.freemysqlhosting.net',
696 user='sql12371206',passwd='tmPj6XBlDK',database='sql12371206')
697 cur = mycon.cursor()
698 cur.execute("select * from staff_management")
699 rows = cur.fetchall()
700 if len(rows) != 0:
701 staff_table.delete(*staff_table.get_children())
702 for row in rows:
703 staff_table.insert("", END, values=row)
704 mycon.commit()
705 mycon.close()
706
707 def update2_data():
708 mycon = my.connect(host='sql12.freemysqlhosting.net',
709 user='sql12371206',passwd='tmPj6XBlDK',database='sql12371206'
710 )
711 cur = mycon.cursor()
712 query = 'select staff_id from staff_management'
713 cur.execute(query)

36 | P a g e
714 data = cur.fetchall()
715 tu = ()
716 for i in data:
717 tu = tu + i
718 staffid_ent.destroy()
719
720 #================UPDATE FUNCTION================
721 def get(event):
722 staff_id = combo_staffid.get()
723 mycon = my.connect(host='sql12.freemysqlhosting.net',
724 user='sql12371206',passwd='tmPj6XBlDK',database='sql123712
725 06')
726 cur = mycon.cursor()
727 query = 'Select first_name, qualification,sub_dep,\
728 dob, date_of_joining, phone,gender,address,' \
729 ' last_name,' \
730 ' course, email, sal,religion, landline, bloodgrp' \
731 ' from staff_management where staff_id = "%s" ' % staff
732 _id
733 cur.execute(query)
734 data = cur.fetchall()
735 mycon.close()
736
737 tup = ( firstname2_ent, qualif1_ent, combo_sub_dep, dob2_e
738 nt,
739 join_date_ent, phone2_ent, combo_gender2,txt_address2,
740 lastname2_ent, combo_course2, email_ent,
741 sal_ent, combo_religion2, landline2_ent,combo_bloodgrp2)
742 info = data[0]
743 n = len(info)
744 for i in tup:
745 try:
746 i.set('')
747 except:
748 i.delete(0, END)
749
750 for i in range(n):
751 try:
752 tup[i].set(info[i])
753 except:
754 tup[i].insert(0, info[i])
755
756 combo_staffid = ttk.Combobox(frm1, width=13,font=("times\
757 new roman", 13),state='readonly')
758 combo_staffid['values'] = tu

37 | P a g e
759 combo_staffid.bind('<<ComboboxSelected>>', get)
760 combo_staffid.grid(row=0, column=1, pady=10, padx=0,sticky="w"
761 )
762 mycon.close()
763
764 def save():
765 tup = (firstname2_ent, qualif1_ent, combo_sub_dep, dob2_en
766 t,
767 join_date_ent, phone2_ent, combo_gender2,txt_address2,
768 lastname2_ent, combo_course2, email_ent,
769 sal_ent, combo_religion2, landline2_ent,combo_bloodgrp2,
770 combo_staffid)
771 query = "update staff_management set first_name='%s',\
772 qualification='%s',sub_dep='%s', dob='%s'," \
773 "date_of_joining='%s',phone='%s', gender='%s',\
774 address='%s',last_name='%s', " \
775 "course='%s', email='%s', sal='%s',religion='%s'\
776 ,landline='%s'," \
777 "bloodgrp='%s' where staff_id='%s'"
778 mys_query(query, tup)
779
780 for i in tup:
781 try:
782 i.set('')
783 except:
784 i.delete(0, END)
785
786 fetch_data2()
787 save2_btn.config(command=save)
788 update1_btn.destroy()
789
790 def cancel():
791 tup = (combo_staffid, firstname2_ent,qualif1_ent,
792 combo_sub_dep, dob2_ent, join_date_ent,
793 phone2_ent, combo_gender2,txt_address2,
794 lastname2_ent, combo_course2,email_ent,
795 sal_ent, combo_religion2,landline2_ent,combo_bloodgrp2)
796 for i in tup:
797 try:
798 i.set('')
799 except:
800 i.delete(0, END)
801 staff_window()
802
803 cancel_btn = Button(option_subframe, width=20,text='Cancel',

38 | P a g e
804 bg="#072746",fg="white", command=cancel)
805 cancel_btn.place(x=50, y=155)
806
807 def delete():
808 mycon = my.connect(host='sql12.freemysqlhosting.net',
809 user='sql12371206',passwd='tmPj6XBlDK',database='sql123712
810 06')
811 cur = mycon.cursor()
812 main_staffid = combo_staffid.get()
813
814 query = "delete from staff_management \
815 where staff_id='%s'" % (main_staffid)
816 cur.execute(query)
817 mycon.commit()
818 query1 = "select * from staff_management"
819 cur.execute(query1)
820 data = cur.fetchall()
821 for row in staff_table.get_children():
822 staff_table.delete(row)
823 for row in data:
824 staff_table.insert('', 'end', value=row)
825 mycon.close()
826 tup = (firstname2_ent, qualif1_ent, combo_sub_dep,dob2_ent
827 ,
828 join_date_ent, phone2_ent, combo_gender2,txt_address2,
829 lastname2_ent, combo_course2, email_ent,
830 sal_ent, combo_religion2, landline2_ent,combo_bloodgrp2,
831 combo_staffid)
832 for i in tup:
833 try:
834 i.set('')
835 except:
836 i.delete(0, END)
837 staff_window()
838
839 delete_btn = Button(option_subframe, width=20,text='Delete',
840 bg="#072746",fg="white", command=delete)
841 delete_btn.place(x=50, y=200)
842
843 option_subframe = Frame(frm1, bd=2, relief=FLAT,bg="#e4dacb")
844 option_subframe.place(x=900, y=50, width=250, height=400)
845 save2_btn =Button(option_subframe, width=20, text='SAVE',bg="#0727
846 46", fg="white", command=save2)
847 save2_btn.place(x=50, y=105)
848 update1_btn = Button(option_subframe, width=20, text='EDIT',

39 | P a g e
849 bg="#072746", fg="white",command=update2_data)
850 update1_btn.place(x=50, y=155)
851
852 #============SEARCH BAR====================
853 def search2():
854 mycon = my.connect(host='sql12.freemysqlhosting.net',
855 user='sql12371206',passwd='tmPj6XBlDK',database='sql12371206')
856 cur = mycon.cursor()
857 val = txt_search1.get()
858 value = '%' + str(val) + '%'
859 tup1 = (value, value, value, value, value, value, value, value
860 ,
861 value, value, value, value,value, value, value, value)
862
863 query = "select*from staff_management where staff_id like ('%s
864 ')\
865 or first_name like ('%s') " \
866 "or qualification like ('%s') or sub_dep like ('%s')\
867 or dob like ('%s') " \
868 "or date_of_joining like ('%s') or phone like ('%s')"\
869 "or gender like ('%s') or address like ('%s') " \
870 "or last_name like ('%s') or course like ('%s') "\
871 "or email like ('%s') or sal like ('%s')" \
872 "or religion like ('%s') or landline like ('%s') or\
873 bloodgrp like ('%s') " % tup1
874
875 cur.execute(query)
876 data = cur.fetchall()
877
878 for row in staff_table.get_children():
879 staff_table.delete(row)
880 for row in data:
881 staff_table.insert('', 'end', value=row)
882 mycon.commit()
883 mycon.close()
884
885 txt_search1 = Entry(frm2, width=50,font=("times new roman",
886 12, 'bold'),bd=5, relief=GROOVE)
887 txt_search1.place(x=300, y=15)
888
889 search1_btn = Button(frm2, height=1, width=15, text='SEARCH',bg=
890 "#072746", fg="white",command=search2,
891 font=("times new roman", 12, 'bold'))
892 search1_btn.place(x=750, y=15)
893

40 | P a g e
894 # ==================STAFF SEARCH TABLE=====================
895 table2_frame = Frame(frm2, bd=4, relief=RIDGE, bg='#fecea8')
896 table2_frame.place(x=10, y=70, width=1140, height=350)
897
898 scroll_x2 = Scrollbar(table2_frame, orient=HORIZONTAL)
899 scroll_y2 = Scrollbar(table2_frame, orient=VERTICAL)
900 staff_table = ttk.Treeview(table2_frame,columns=("STAFF ID",
901 "FIRST NAME",\
902 "QUALIFICATION","SUB/DEP", "DOB",
903 "DATE OF JOINING", "PHONE NUMBER","GENDER"
904 , \
905 "ADDRESS", "LAST NAME", "COURSE",
906 "EMAIL", "SALARY", "RELIGION",\
907 "LANDLINE NUMBER", "BLOOD GROUP"),
908 xscrollcommand=scroll_x2.set,yscrollcommand=scroll_y2.s
909 et)
910 scroll_x2.pack(side=BOTTOM, fill=X)
911 scroll_y2.pack(side=RIGHT, fill=Y)
912 scroll_x2.config(command=staff_table.xview)
913 scroll_y2.config(command=staff_table.yview)
914 staff_table.heading("STAFF ID", text="STAFF ID")
915 staff_table.heading("FIRST NAME", text="FIRST NAME")
916 staff_table.heading("QUALIFICATION", text="QUALIFICATION")
917 staff_table.heading("SUB/DEP", text="SUB/DEP")
918 staff_table.heading("DOB", text="DOB")
919 staff_table.heading("DATE OF JOINING", text="DATE OF JOINING")
920 staff_table.heading("PHONE NUMBER", text="PHONE NUMBER")
921 staff_table.heading("GENDER", text="GENDER")
922 staff_table.heading("ADDRESS", text="ADDRESS")
923 staff_table.heading("LAST NAME", text="LAST NAME")
924 staff_table.heading("COURSE", text="COURSE")
925 staff_table.heading("EMAIL", text="EMAIL")
926 staff_table.heading("SALARY", text="SALARY")
927 staff_table.heading("RELIGION", text="RELIGION")
928 staff_table.heading("LANDLINE NUMBER", text="LANDLINE NUMBER")
929 staff_table.heading("BLOOD GROUP", text="BLOOD GROUP")
930
931 staff_table["show"] = "headings"
932
933 staff_table.column("STAFF ID", width=100)
934 staff_table.column("FIRST NAME", width=100)
935 staff_table.column("QUALIFICATION", width=120)
936 staff_table.column("SUB/DEP", width=100)
937 staff_table.column("DOB", width=70)
938 staff_table.column("DATE OF JOINING", width=120)

41 | P a g e
939 staff_table.column("PHONE NUMBER", width=120)
940 staff_table.column("GENDER", width=90)
941 staff_table.column("ADDRESS", width=130)
942 staff_table.column("LAST NAME", width=100)
943 staff_table.column("COURSE", width=100)
944 staff_table.column("EMAIL", width=120)
945 staff_table.column("SALARY", width=100)
946 staff_table.column("RELIGION", width=100)
947 staff_table.column("LANDLINE NUMBER", width=150)
948 staff_table.column("BLOOD GROUP", width=100)
949 staff_table.pack(fill=BOTH, expand=1)
950 fetch_data2()
951
952 #====================EXAM MANAGEMENT WINDOW======================
953 def exam_window():
954 exam_frame = LabelFrame(root, text='EXAM MANAGEMENT SYSTEM')
955 exam_frame.configure(bg="#e4dacb")
956 exam_frame.place(x=100, y=190, width=1170, height=485)
957
958 nb = ttk.Notebook(exam_frame)
959 nb.grid()
960 frm1 = Frame(nb, width=1160, height=437, bg="#e4dacb")
961 frm1.grid(row=0, column=0)
962 nb.add(frm1, text="EXAM DETAILS")
963
964 frm2 = Frame(nb, width=1160, height=437, bg="#e4dacb")
965 frm2.grid(row=0, column=1)
966 nb.add(frm2, text="SEARCH")
967
968 # ==========varaibles=================
969 marks_obt = StringVar()
970 total_marks = StringVar()
971 result = StringVar()
972
973 mycon = my.connect(host='sql12.freemysqlhosting.net',
974 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206')
975 cur = mycon.cursor()
976 query = 'select ad_no from stud_management'
977 cur.execute(query)
978 data=cur.fetchall()
979 mycon.close()
980
981 #============EXAM FRAME================================
982 adno2_lbl = Label(frm1, text="ADMISSION NUMBER",font=("times\
983 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")

42 | P a g e
984 adno2_lbl.grid(row=0, column=0, pady=20, padx=25, sticky="w")
985 adno2_ent = ttk.Combobox(frm1, width=15,font=("times new roman",
986 13),values=data)
987 adno2_ent.grid(row=0, column=1, pady=10, padx=0, sticky="w")
988
989 exam_lbl = Label(frm1, text="EXAM ID",font=("times new roman",
990 15, 'bold'),bg="#e4dacb",fg="#072746")
991 exam_lbl.grid(row=1, column=0, pady=20, padx=25, sticky="w")
992 exam_ent = Entry(frm1, width=15, font=("times new roman", 13)
993 ,bd=2, relief=GROOVE)
994 exam_ent.grid(row=1, column=1, pady=10, padx=0, sticky="w")
995
996 firstname2_lbl = Label(frm1, text="NAME",font=("times new roman",
997 15, 'bold'),bg="#e4dacb",fg="#072746")
998 firstname2_lbl.grid(row=2, column=0, pady=20, padx=25,sticky="w")
999 firstname2_ent = Entry(frm1, width=15,font=("times new roman", 13)
1000 ,
1001 bd=2,relief=GROOVE)
1002 firstname2_ent.grid(row=2, column=1, pady=10, padx=0,sticky="w")
1003
1004 marks_obt_lbl = Label(frm1, text="MARKS OBTAINED",font=("times \
1005 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1006 marks_obt_lbl.grid(row=3, column=0, pady=20, padx=25,sticky="w")
1007 marks_obt_ent=Entry(frm1,textvariable=marks_obt,width=15,font=("ti
1008 mes\
1009 new roman", 13), bd=2,relief=GROOVE)
1010 marks_obt_ent.grid(row=3, column=1, pady=10, padx=0,sticky="w")
1011
1012 total_marks_lbl = Label(frm1, text="TOTAL MARKS",font=("times new\
1013 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1014 total_marks_lbl.grid(row=4, column=0, pady=20, padx=25,sticky="w")
1015 total_marks_ent = Entry(frm1, textvariable=total_marks, width=15,
1016 font=("times new roman", 13), bd=2,relief=GROOVE)
1017 total_marks_ent.grid(row=4, column=1, pady=10, padx=0,sticky="w")
1018
1019 def calpercent():
1020 marksobt = float(marks_obt.get())
1021 totalmarks = float(total_marks.get())
1022 percentage = marksobt / totalmarks * 100
1023 result.set(percentage)
1024
1025 percentage_btn = Button(frm1, text="PERCENTAGE", bd=2,font=("times
1026 \
1027 new roman",15, 'bold'),command=calpercent, bg="#e4dacb",fg="#0727
1028 46")

43 | P a g e
1029 percentage_btn.grid(row=5, column=0, pady=20, padx=25,sticky="w")
1030 percentage_ent = Entry(frm1,textvariable=result,width=15,font=("ti
1031 mes\
1032 new roman", 13), bd=2,relief=GROOVE)
1033 percentage_ent.grid(row=5, column=1, pady=10, padx=0,sticky="w")
1034
1035
1036 def save3():
1037 tup = (adno2_ent,exam_ent, firstname2_ent,marks_obt_ent,
1038 total_marks_ent,percentage_ent)
1039 query = "insert into exam values ('%s','%s','%s','%s','%s','%s
1040 ')"
1041 mys_query(query, tup)
1042
1043 for i in tup:
1044 try:
1045 i.set('')
1046 except:
1047 i.delete(0, END)
1048
1049 info_frame = Frame(frm1, bd=0)
1050 info_frame.place(relx=0.46, rely=0.12, relwidth=0.3)
1051 label=Label(info_frame)
1052 label.pack()
1053
1054 option_subframe =Frame(frm1, bd=2, relief=FLAT, bg="#e4dacb")
1055 option_subframe.place(x=900, y=50, width=250, height=400)
1056 save3_btn = Button(option_subframe, width=20, text='SAVE',
1057 bg="#072746", fg="white", command=save3)
1058 save3_btn.place(x=50, y=105)
1059
1060 def new_frame(event):
1061 mycon = my.connect(host='sql12.freemysqlhosting.net',
1062 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
1063 )
1064 cur = mycon.cursor()
1065 adno = adno2_ent.get()
1066 print(adno)
1067 cur.execute('Select * from stud_management\
1068 where ad_no''="%s"' %(adno))
1069 data = cur.fetchall()
1070 info=''
1071 head = ('Admission Number', 'First Name', 'Fathers Name',
1072 'Fathers Occupation', 'Date of Birth', 'Course','Phone Number'
1073 ,

44 | P a g e
1074 'Gender', 'Address','Admission Date', 'Last Name',
1075 'Mothers Name','Mothers Occupation', 'Class',
1076 'Section', 'Landline', 'Religion','Blood Group')
1077
1078 for i in range(18):
1079 info = info + (head[i] + ': ' + data[0][i])
1080 info = info + '\n'
1081
1082 label.config(text=info)
1083 adno2_ent.bind('<<ComboboxSelected>>', new_frame)
1084
1085 #================SEARCH BAR TABLE====================
1086 def fetch_data3():
1087 mycon = my.connect(host='sql12.freemysqlhosting.net',
1088 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
1089 )
1090 cur = mycon.cursor()
1091 cur.execute("select * from exam")
1092 rows = cur.fetchall()
1093 if len(rows) != 0:
1094 exam_table.delete(*exam_table.get_children())
1095 for row in rows:
1096 exam_table.insert("", END, values=row)
1097 mycon.commit()
1098 mycon.close()
1099
1100 def search3():
1101 mycon = my.connect(host='sql12.freemysqlhosting.net',
1102 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206
1103 ')
1104 cur = mycon.cursor()
1105 val = txt_search3.get()
1106 value = '%' + str(val) + '%'
1107 tup1 = (value, value, value, value, value, value)
1108
1109 query = "select*from exam where ad_no like ('%s') or \
1110 exam_id like ('%s') " \
1111 "or name like ('%s') or marks_obtained like ('%s')\
1112 or total_marks like ('%s') " \
1113 "or percentage like ('%s') " % tup1
1114
1115 cur.execute(query)
1116 data = cur.fetchall()
1117
1118 for row in exam_table.get_children():

45 | P a g e
1119 exam_table.delete(row)
1120 for row in data:
1121 exam_table.insert('', 'end', value=row)
1122 mycon.commit()
1123 mycon.close()
1124
1125 txt_search3 = Entry(frm2,width=50,font=( "times new roman",12,
1126 'bold'),bd=5, relief=GROOVE)
1127 txt_search3.place(x=300, y=15)
1128
1129 search3_btn =Button(frm2,height=1,width=15,text='SEARCH',bg="#0727
1130 46", fg="white",command=search3,font=("times new roman",12, 'b
1131 old'))
1132 search3_btn.place(x=750, y=15)
1133
1134 table3_frame =Frame(frm2, bd=4, relief=RIDGE, bg='#fecea8')
1135 table3_frame.place(x=10, y=70, width=1140, height=350)
1136
1137
1138 scroll_x2 = Scrollbar(table3_frame, orient=HORIZONTAL)
1139 scroll_y2 = Scrollbar(table3_frame, orient=VERTICAL)
1140 exam_table = ttk.Treeview(table3_frame, columns=("ADMISSION NUMBER
1141 ",
1142 "EXAM ID", "NAME","MARKS OBTAINED", "TOTAL MARKS",
1143 "PERCENTAGE"),
1144 xscrollcommand=scroll_x2.set,yscrollcommand=scroll_y2.set)
1145 scroll_x2.pack(side=BOTTOM, fill=X)
1146 scroll_y2.pack(side=RIGHT, fill=Y)
1147 scroll_x2.config(command=exam_table.xview)
1148 scroll_y2.config(command=exam_table.yview)
1149 exam_table.heading("ADMISSION NUMBER", text="ADMISSION NUMBER")
1150 exam_table.heading("EXAM ID", text="EXAM ID")
1151 exam_table.heading("NAME", text="NAME")
1152 exam_table.heading("MARKS OBTAINED", text="MARKS OBTAINED")
1153 exam_table.heading("TOTAL MARKS", text="TOTAL MARKS")
1154 exam_table.heading("PERCENTAGE", text="PERCENTAGE")
1155
1156 exam_table["show"] = "headings"
1157
1158 exam_table.column("ADMISSION NUMBER", width=150)
1159 exam_table.column("EXAM ID", width=100)
1160 exam_table.column("NAME", width=100)
1161 exam_table.column("MARKS OBTAINED", width=100)
1162 exam_table.column("TOTAL MARKS", width=110)
1163 exam_table.column("PERCENTAGE", width=110)

46 | P a g e
1164 exam_table.pack(fill=BOTH, expand=1)
1165 fetch_data3()
1166
1167 #======================FEE MANAGEMENT WINDOW======================
1168 def fee_window():
1169 fee_frame =LabelFrame(root, text='FEES MANAGEMENT SYSTEM')
1170 fee_frame.configure(bg="#e4dacb")
1171 fee_frame.place(x=100, y=190, width=1170, height=485)
1172
1173 nb = ttk.Notebook(fee_frame)
1174 nb.grid()
1175 frm1 = Frame(nb, width=1160, height=437, bg="#e4dacb")
1176 frm1.grid(row=0, column=0)
1177 nb.add(frm1, text="FEES DETAILS")
1178
1179 frm2 = Frame(nb, width=1160, height=437, bg="#e4dacb")
1180 frm2.grid(row=0, column=1)
1181 nb.add(frm2, text="SEARCH")
1182 #------------------VARIABLES--------------
1183 totalfee = StringVar()
1184 amt = StringVar()
1185
1186 mycon = my.connect(host='sql12.freemysqlhosting.net',
1187 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206')
1188 cur = mycon.cursor()
1189 query = 'select ad_no from stud_management'
1190 cur.execute(query)
1191 data=cur.fetchall()
1192 mycon.close()
1193
1194 #=====================FEE FRAME============================
1195 adno3_lbl = Label(frm1, text="ADMISSION NUMBER",font=("times\
1196 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1197 adno3_lbl.grid(row=0, column=0, pady=10, padx=25, sticky="w")
1198 adno3_ent = ttk.Combobox(frm1, width=15,font=("times new roman", 1
1199 3),
1200 values=data)
1201 adno3_ent.grid(row=0, column=1, pady=10, padx=0, sticky="w")
1202
1203 fee_lbl = Label(frm1, text="RECIEPT NUMBER",font=("times new\
1204 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1205 fee_lbl.grid(row=1, column=0, pady=10, padx=25, sticky="w")
1206 fee_ent = Entry(frm1, width=15, font=("times new roman", 13),
1207 bd=2, relief=GROOVE)
1208 fee_ent.grid(row=1, column=1, pady=10, padx=0, sticky="w")

47 | P a g e
1209
1210 firstname3_lbl = Label(frm1, text="NAME",font=("times new roman",
1211 15, 'bold'),bg="#e4dacb",fg="#072746")
1212 firstname3_lbl.grid(row=2, column=0, pady=10, padx=25,sticky="w")
1213 firstname3_ent = Entry(frm1, width=15,font=("times new roman", 13)
1214 , bd=2,relief=GROOVE)
1215 firstname3_ent.grid(row=2, column=1, pady=10, padx=0,sticky="w")
1216
1217 totalfee_lbl = Label(frm1, text="TOTAL FEES",font=("times new \
1218 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1219 totalfee_lbl.grid(row=3, column=0, pady=10, padx=25,sticky="w")
1220 totalfee_ent = Entry(frm1,width=15,textvariable=totalfee,font=("ti
1221 mes\
1222 new roman", 13), bd=2,relief=GROOVE)
1223 totalfee_ent.grid(row=3, column=1, pady=10, padx=0,sticky="w")
1224
1225 paiddate_lbl = Label(frm1, text="PAYMENT DATE",font=("times new\
1226 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1227 paiddate_lbl.grid(row=4, column=0, pady=10, padx=25, sticky="w")
1228 paiddate_ent = tkcalendar.DateEntry(frm1, width=13,font=("times\
1229 new roman", 13),relief=GROOVE)
1230 paiddate_ent.delete(0, END)
1231 paiddate_ent.grid(row=4, column=1, pady=10, padx=0, sticky="w")
1232
1233 semester_lbl = Label(frm1, text="SEMESTER",font=("times new\
1234 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1235 semester_lbl.grid(row=5, column=0, pady=10,padx=25,sticky="w")
1236 combo_semester = ttk.Combobox(frm1, width=13, text="SEMESTER",
1237 font=("times new roman", 13),state='readonly')
1238 combo_semester["values"] = ("1st TERM", "2nd TERM","3rd TERM")
1239 combo_semester.grid(row=5, column=1, padx=0, sticky='w')
1240
1241 modeofpay_lbl = Label(frm1, text="MODE OF PAYMENT",font=("times ne
1242 w\
1243 roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1244 modeofpay_lbl.grid(row=6, column=0, pady=10, padx=25,sticky="w")
1245 combo_mode = ttk.Combobox(frm1, width=13,text="MODE OF PAYMENT",
1246 font=("times new roman", 13),state='readonly')
1247 combo_mode["values"] = ("CASH", "CARD")
1248 combo_mode.grid(row=6, column=1, padx=0, sticky='w')
1249
1250 amount_lbl = Label(frm1, text="AMOUNT",font=("times new roman", 15
1251 ,
1252 'bold'),bg="#e4dacb",fg="#072746")
1253 amount_lbl.grid(row=7, column=0, pady=10, padx=25,sticky="w")

48 | P a g e
1254 amount_ent = Entry(frm1, width=15,textvariable=amt,font=
1255 ("times new roman", 13), bd=2,relief=GROOVE)
1256 amount_ent.grid(row=7, column=1, pady=10, padx=0,sticky="w")
1257
1258 def save4():
1259 tup = (adno3_ent,fee_ent, firstname3_ent,totalfee_ent,
1260 paiddate_ent,combo_semester,combo_mode,amount_ent)
1261 query = "insert into fee values ('%s','%s','%s','%s'\
1262 ,'%s','%s','%s','%s')"
1263 mys_query(query, tup)
1264 for i in tup:
1265 try:
1266 i.set('')
1267 except:
1268 i.delete(0, END)
1269
1270 info2_frame =Frame(frm1, bd=0)
1271 info2_frame.place(relx=0.46, rely=0.12, relwidth=0.3)
1272 label=Label(info2_frame)
1273 label.pack()
1274
1275 option_subframe =Frame(frm1, bd=2, relief=FLAT, bg="#e4dacb")
1276 option_subframe.place(x=900, y=50, width=250, height=400)
1277 save4_btn = Button(option_subframe, width=20, text='SAVE',
1278 bg="#072746", fg="white", command=save4)
1279 save4_btn.place(x=50, y=105)
1280
1281 def new_frame(event):
1282 mycon = my.connect(host='sql12.freemysqlhosting.net',
1283 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
1284 )
1285 cur = mycon.cursor()
1286 adno = adno3_ent.get()
1287 print(adno)
1288 cur.execute('Select * from stud_management where ad_no''="%s"'
1289 %
1290 (adno))
1291 data = cur.fetchall()
1292 info=''
1293 head = ('Admission Number','First Name', 'Fathers Name',
1294 'Fathers Occupation', 'Date of Birth', 'Course',
1295 'Phone Number', 'Gender', 'Address',
1296 'Admission Date', 'Last Name', 'Mothers Name',
1297 'Mothers Occupation', 'Class',
1298 'Section', 'Landline', 'Religion','Blood Group')

49 | P a g e
1299
1300 for i in range(18):
1301 info = info + (head[i] + ': ' + data[0][i])
1302 info = info + '\n'
1303
1304 label.config(text=info)
1305 adno3_ent.bind('<<ComboboxSelected>>', new_frame)
1306
1307 #===============SEARCH BAR===========================
1308 def fetch_data4():
1309 mycon = my.connect(host='sql12.freemysqlhosting.net',
1310 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
1311 )
1312 cur = mycon.cursor()
1313 cur.execute("select * from fee")
1314 rows = cur.fetchall()
1315 if len(rows) != 0:
1316 fee_table.delete(*fee_table.get_children())
1317 for row in rows:
1318 fee_table.insert("", END, values=row)
1319 mycon.commit()
1320 mycon.close()
1321
1322 def search4():
1323 mycon = my.connect(host='sql12.freemysqlhosting.net',
1324 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206'
1325 )
1326 cur = mycon.cursor()
1327 val = txt_search4.get()
1328 value = '%' + str(val) + '%'
1329 tup1 = (value, value, value, value, value, value, value, value
1330 )
1331
1332 query = "select*from fee where ad_no like ('%s') or \
1333 fee_id like ('%s') " \
1334 "or name like ('%s') or total_fees like ('%s')or\
1335 paid_date like ('%s') or semester like ('%s') " \
1336 "or mode_pay like ('%s')or amount like ('%s') " % tup1
1337
1338 cur.execute(query)
1339 data = cur.fetchall()
1340
1341 for row in fee_table.get_children():
1342 fee_table.delete(row)
1343 for row in data:

50 | P a g e
1344 fee_table.insert('', 'end', value=row)
1345 mycon.commit()
1346 mycon.close()
1347
1348 txt_search4 =Entry(frm2,width=50,font=( "times new roman",12,
1349 'bold'),bd=5, relief=GROOVE)
1350 txt_search4.place(x=300, y=15)
1351
1352 search4_btn=Button(frm2,height=1,width=15,text='SEARCH',bg="#07274
1353 6", fg="white",command=search4,font=("times new roman",12, 'bo
1354 ld'))
1355 search4_btn.place(x=750, y=15)
1356
1357 table4_frame =Frame(frm2, bd=4, relief=RIDGE, bg='#fecea8')
1358 table4_frame.place(x=10, y=70, width=1140, height=350)
1359
1360 scroll_x2 = Scrollbar(table4_frame, orient=HORIZONTAL)
1361 scroll_y2 = Scrollbar(table4_frame, orient=VERTICAL)
1362 fee_table = ttk.Treeview(table4_frame, columns=("ADMISSION NUMBER"
1363 ,
1364
1365 "RECIEPT NUMBER", "NAME","TOTAL FEES", "PAYMENT DATE",
1366 "SEMESTER","MODE OF PAYMENT","AMOUNT"),
1367 xscrollcommand=scroll_x2.set,yscrollcommand=scroll_y2.set)
1368
1369 scroll_x2.pack(side=BOTTOM, fill=X)
1370 scroll_y2.pack(side=RIGHT, fill=Y)
1371 scroll_x2.config(command=fee_table.xview)
1372 scroll_y2.config(command=fee_table.yview)
1373 fee_table.heading("ADMISSION NUMBER", text="ADMISSION NUMBER")
1374 fee_table.heading("RECIEPT NUMBER", text="RECIEPT NUMBER")
1375 fee_table.heading("NAME", text="NAME")
1376 fee_table.heading("TOTAL FEES", text="TOTAL FEES")
1377 fee_table.heading("PAYMENT DATE", text="PAYMENT DATE")
1378 fee_table.heading("SEMESTER", text="SEMESTER")
1379 fee_table.heading("MODE OF PAYMENT", text="MODE OF PAYMENT")
1380 fee_table.heading("AMOUNT", text="AMOUNT")
1381
1382
1383 fee_table["show"] = "headings"
1384 fee_table.column("ADMISSION NUMBER", width=150)
1385 fee_table.column("RECIEPT NUMBER", width=130)
1386 fee_table.column("NAME", width=100)
1387 fee_table.column("TOTAL FEES", width=100)
1388 fee_table.column("PAYMENT DATE", width=110)

51 | P a g e
1389 fee_table.column("SEMESTER", width=100)
1390 fee_table.column("MODE OF PAYMENT", width=150)
1391 fee_table.column("AMOUNT", width=100)
1392 fee_table.pack(fill=BOTH, expand=1)
1393 fetch_data4()
1394
1395 #================ATTENDANCE WINDOW=============================
1396 def attendance_window():
1397 atd_frame =LabelFrame(root, text='ATTENDANCE MANAGEMENT SYSTEM')
1398 atd_frame.configure(bg="#e4dacb")
1399 atd_frame.place(x=100, y=190, width=1170, height=485)
1400
1401 nb = ttk.Notebook(atd_frame)
1402 nb.grid()
1403 frm1 = Frame(nb, width=1160, height=437, bg="#e4dacb")
1404 frm1.grid(row=0, column=0)
1405 nb.add(frm1, text="ATTENDANCE DETAILS")
1406
1407 frm2 = Frame(nb, width=1160, height=437, bg="#e4dacb")
1408 frm2.grid(row=0, column=1)
1409 nb.add(frm2, text="SEARCH")
1410 #----------------VARIABLES---------------------
1411 total_days= StringVar()
1412 no_present = StringVar()
1413 no_absent = StringVar()
1414 #-------------------------
1415 mycon = my.connect(host='sql12.freemysqlhosting.net',
1416 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206')
1417 cur = mycon.cursor()
1418 query = 'select ad_no from stud_management'
1419 cur.execute(query)
1420 data=cur.fetchall()
1421 mycon.close()
1422
1423
1424 #================ATTENDANCE FRAME=======================
1425 adno4_lbl = Label(frm1, text="ADMISSION NUMBER",font=("times \
1426 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1427 adno4_lbl.grid(row=0, column=0, pady=20, padx=50, sticky="w")
1428 adno4_ent = ttk.Combobox(frm1, width=15,font=("times new roman",
1429 13),values=data)
1430 adno4_ent.grid(row=0, column=1, pady=10, padx=0, sticky="w")
1431
1432 firstname4_lbl = Label(frm1, text="NAME",font=("times new roman",
1433 15, 'bold'),bg="#e4dacb",fg="#072746")

52 | P a g e
1434 firstname4_lbl.grid(row=1, column=0, pady=20, padx=50,sticky="w")
1435 firstname4_ent = Entry(frm1, width=15,font=("times new roman",
1436 13), bd=2,relief=GROOVE)
1437 firstname4_ent.grid(row=1, column=1, pady=10, padx=0,sticky="w")
1438
1439 totaldays_lbl = Label(frm1, text="TOTAL NUMBER OF DAYS",font=("tim
1440 es\
1441 new roman", 15, 'bold'),bg="#e4dacb",fg="#072746")
1442 totaldays_lbl.grid(row=3, column=0, pady=20, padx=50,sticky="w")
1443 totaldays_ent=Entry(frm1,width=15,textvariable=total_days,
1444 font=("times new roman", 13), bd=2,relief=GROOVE)
1445 totaldays_ent.grid(row=3, column=1, pady=10, padx=0,sticky="w")
1446 totalpresent_lbl = Label(frm1, text="NUMBER OF DAYS PRESENT",
1447 font=("times new roman", 15, 'bold'),bg="#e4dacb",fg="#072746"
1448 )
1449 totalpresent_lbl.grid(row=4, column=0, pady=20, padx=50,sticky="w"
1450 )
1451 totalpresent_ent = Entry(frm1, width=15,textvariable=no_present,
1452 font=("times new roman", 13), bd=2,relief=GROOVE)
1453 totalpresent_ent.grid(row=4, column=1, pady=10, padx=0,sticky="w")
1454
1455 totalabsent_lbl = Label(frm1, text="NUMBER OF DAYS ABSENT",
1456 font=("times new roman", 15, 'bold'),bg="#e4dacb",fg="#072746"
1457 )
1458 totalabsent_lbl.grid(row=5, column=0, pady=20, padx=50,sticky="w")
1459 totalabsent_ent = Entry(frm1, width=15,textvariable=no_absent,
1460 font=("times new roman", 13), bd=2,relief=GROOVE)
1461 totalabsent_ent.grid(row=5, column=1, pady=10, padx=0,sticky="w")
1462
1463 def save5():
1464 tup = (adno4_ent,firstname4_ent,totaldays_ent,
1465 totalpresent_ent,totalabsent_ent)
1466 query = "insert into attendance values ('%s','%s','%s','%s','%
1467 s')"
1468 mys_query(query, tup)
1469 for i in tup:
1470 try:
1471 i.set('')
1472 except:
1473 i.delete(0, END)
1474
1475 info3_frame =Frame(frm1, bd=0)
1476 info3_frame.place(relx=0.46, rely=0.12, relwidth=0.3)
1477 label=Label(info3_frame)
1478 label.pack()

53 | P a g e
1479
1480 option_subframe =Frame(frm1, bd=2, relief=FLAT, bg="#e4dacb")
1481 option_subframe.place(x=900, y=50, width=250, height=400)
1482 save5_btn = Button(option_subframe, width=20, text='SAVE',
1483 bg="#072746", fg="white", command=save5)
1484 save5_btn.place(x=50, y=105)
1485
1486 def new_frame(event):
1487 mycon = my.connect(host='sql12.freemysqlhosting.net',
1488 user='sql12371206',passwd='tmPj6XBlDK', database='sql123712
1489 06')
1490 cur = mycon.cursor()
1491 adno = adno4_ent.get()
1492 print(adno)
1493 cur.execute('Select * from stud_management where ad_no''="%s"'
1494 \
1495 %(adno))
1496 data = cur.fetchall()
1497 info=''
1498 head = ('Admission Number', 'First Name', 'Fathers Name',
1499 'Fathers Occupation', 'Date of Birth', 'Course',
1500 'Phone Number', 'Gender', 'Address',
1501 'Admission Date', 'Last Name', 'Mothers Name',
1502 'Mothers Occupation', 'Class',
1503 'Section', 'Landline', 'Religion','Blood Group')
1504
1505 for i in range(18):
1506 info = info + (head[i] + ': ' + data[0][i])
1507 info = info + '\n'
1508
1509 label.config(text=info)
1510 adno4_ent.bind('<<ComboboxSelected>>', new_frame)
1511
1512 #===================SEARCH BAR=================
1513 def fetch_data5():
1514 mycon = my.connect(host='sql12.freemysqlhosting.net',
1515 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206
1516 ')
1517 cur = mycon.cursor()
1518 cur.execute("select * from attendance")
1519 rows = cur.fetchall()
1520 if len(rows) != 0:
1521 atd_table.delete(*atd_table.get_children())
1522 for row in rows:
1523 atd_table.insert("", END, values=row)

54 | P a g e
1524 mycon.commit()
1525 mycon.close()
1526
1527 def search5():
1528 mycon = my.connect(host='sql12.freemysqlhosting.net',
1529 user='sql12371206',passwd='tmPj6XBlDK', database='sql12371206
1530 ')
1531 cur = mycon.cursor()
1532 val = txt_search5.get()
1533 value = '%' + str(val) + '%'
1534 tup1 = (value, value, value, value, value)
1535
1536 query = "select*from attendance where ad_no like ('%s') " \
1537 "or name like ('%s') or totaldays like ('%s')or\
1538 totalpresent like ('%s') " \
1539 "or totalabsent like ('%s') " % tup1
1540
1541 cur.execute(query)
1542 data = cur.fetchall()
1543
1544 for row in atd_table.get_children():
1545 atd_table.delete(row)
1546 for row in data:
1547 atd_table.insert('', 'end', value=row)
1548 mycon.commit()
1549 mycon.close()
1550 txt_search5 =Entry(frm2,width=50,font=( "times new roman",12,
1551 'bold'),bd=5, relief=GROOVE)
1552 txt_search5.place(x=300, y=15)
1553
1554 search5_btn =Button(frm2,height=1, width=15, text='SEARCH',
1555 bg="#072746", fg="white",command=search5,
1556 font=("times new roman",12, 'bold'))
1557 search5_btn.place(x=750, y=15)
1558
1559 table5_frame =Frame(frm2, bd=4, relief=RIDGE, bg='#fecea8')
1560 table5_frame.place(x=10, y=70, width=1140, height=350)
1561
1562 scroll_x2 = Scrollbar(table5_frame, orient=HORIZONTAL)
1563 scroll_y2 = Scrollbar(table5_frame, orient=VERTICAL)
1564 atd_table = ttk.Treeview(table5_frame, columns=("ADMISSION NUMBER"
1565 ,
1566 "NAME","TOTAL NUMBER OF DAYS", "NUMBER OF DAYS PRESENT",
1567 "NUMBER OF DAYS ABSENT"),
1568 xscrollcommand=scroll_x2.set,yscrollcommand=scroll_y2.set)

55 | P a g e
1569 scroll_x2.pack(side=BOTTOM, fill=X)
1570 scroll_y2.pack(side=RIGHT, fill=Y)
1571 scroll_x2.config(command=atd_table.xview)
1572 scroll_y2.config(command=atd_table.yview)
1573 atd_table.heading("ADMISSION NUMBER", text="ADMISSION NUMBER")
1574 atd_table.heading("NAME", text="NAME")
1575 atd_table.heading("TOTAL NUMBER OF DAYS", text="TOTAL NUMBER OF DA
1576 YS")
1577 atd_table.heading("NUMBER OF DAYS PRESENT",
1578 text="NUMBER OF DAYS PRESENT")
1579 atd_table.heading("NUMBER OF DAYS ABSENT",
1580 text="NUMBER OF DAYS ABSENT")
1581
1582 atd_table["show"] = "headings"
1583 atd_table.column("ADMISSION NUMBER", width=150)
1584 atd_table.column("NAME", width=70)
1585 atd_table.column("TOTAL NUMBER OF DAYS", width=180)
1586 atd_table.column("NUMBER OF DAYS PRESENT", width=200)
1587 atd_table.column("NUMBER OF DAYS ABSENT", width=200)
1588 atd_table.pack(fill=BOTH, expand=1)
1589 fetch_data5()
1590
1591 #===================OPTION FRAME=================================
1592 option_frame = Frame(root, bd=2, relief=FLAT, bg="#a48a73")
1593 option_frame.place(x=113, y=48, width=1140, height=100)
1594
1595 lbl_stud = Button(option_frame,text='STUDENT MANAGEMENT',
1596 relief=RIDGE,command=stud_window,bd=0,font=("times new roman",
1597 16,'bold'),bg="#a48a73", fg='#203c48')
1598 lbl_stud.place(x=0, y=35)
1599
1600 lbl_staff = Button(option_frame,text='STAFF MANAGEMENT',
1601 relief=RIDGE,command=staff_window,bd=0,font=("times new roman",
1602 16, 'bold'),bg="#a48a73", fg='#203c48')
1603 lbl_staff.place(x=275, y=35)
1604
1605 lbl_exam = Button(option_frame,text='EXAM MANAGEMENT',
1606 relief=RIDGE,command=exam_window,bd=0,font=("times new roman",
1607 16, 'bold'),bg="#a48a73", fg='#203c48')
1608 lbl_exam.place(x=525, y=35)
1609
1610 lbl_fees = Button(option_frame, text='FEES MANAGEMENT',
1611 relief=RIDGE,command=fee_window, bd=0,font=("times new roman",
1612 15, 'bold'),bg="#a48a73", fg='#203c48')
1613 lbl_fees.place(x=770, y=35)

56 | P a g e
1614
1615 lbl_attendance = Button(option_frame, text='ATTENDANCE',
1616 relief=RIDGE,command=attendance_window, bd=0,font=("times new roma
1617 n",
1618 15, 'bold'), bg="#a48a73", fg='#203c48')
1619 lbl_attendance.place(x=990, y=35)
1620
1621 root.mainloop()

57 | P a g e
OUTPUT

1. REGISTRATION:

58 | P a g e
2. SIGN-UP

59 | P a g e
3. FORGET PASSWORD

60 | P a g e
4. HOMEPAGE

61 | P a g e
5. STUDENT MANAGEMENT

• EDIT

62 | P a g e
• SEARCH TABLE

• SEARCH OUTPUT

63 | P a g e
6. STAFF MANAGEMENT

• EDIT

64 | P a g e
• SEARCH TABLE

• SEARCH BAR

65 | P a g e
8. EXAM MANAGEMENT

• INSERT RECORD

66 | P a g e
• SEARCH BAR

67 | P a g e
9. FEES MANAGEMENT

68 | P a g e
• SEARCH BAR

69 | P a g e
10. ATTENDANCE MANAGEMENT

• INSERT RECORD

70 | P a g e
• SEARCH BAR

71 | P a g e
11. LOGOUT

72 | P a g e
BIBLOGRAPHY
• https://stackoverflow.com/
• https://realpython.com/
• https://www.geeksforgeeks.org/python-
programming-language/
• https://www.codemy.net/
• https://www.tutorialspoint.com/python/inde
x.htm
• Computer Science with Sumita Arora

73 | P a g e

Potrebbero piacerti anche