Professional Documents
Culture Documents
CSC Project
CSC Project
CSC Project
PROJECT
STUDENT INFORMATION
SYSTEM
BY
HARSHITHA.V
XII ‘D’
1
2
3
ACKNOWLEDGEMENT
4
TABLE OF CONTENTS
1. OVERVIEW OF 3
PYTHON
2. PROJECT 4
DESCRIPTION
3. FUNCTIONS 5
USED
4. FILES USED 9
5. TABLES USED 10
6. SOURCE CODE 12
7. SAMPLE 57
OUTPUTS
8. CONCLUSION 79
9. BIBLIOGRAPHY 80
5
OVERVIEW OF PYTHON
6
PROJECT DESCRIPTION
So, all the information about a student will be available in a few seconds.
Achieving this objective is difficult using a manual system as the
information is scattered. With the help of this system, the school can
maintain the data properly & accurately.
7
USER DEFINED FUNCTIONS USED
8
7. sortStudByEnrollAsc(): This function will call the
function sort view by passing
the argument value as 1, where 1
indicates the sort column as
EnrollNo and order as Asc.
8. sortStudByEnrollDesc(): This function will call the
function sort view by passing
the argument value as 2, where
2 indicates the sort column and
order as Desc.
9. sortStudByNameAsc(): This function will call the
function sort view by passing
the argument value as 3, where
3 indicates the sort column as
Name and order Asc.
10. sortStudByNameDesc(): This function will call the
function sort view by passing
the argument value as 1, where 1
indicates the sort column as
Name and order as Desc.
11. searchByName(): This function will set the search
type global variable where the
Name field will be used in
where condition while
generating SQL statement when
the search window function is
called.
12. searchByEnrollNo(): This function will set the search
type global variable where the
EnrollNo field will be used in
where condition while
generating SQL statement when
the search window function is
called.
13. searchByEmailID(): This function will set the search
type global variable where the
EmailID field will be used in
where condition while
generating SQL statement when
the search window function is
9
called.
14. searchByPhoneNo(): This function will set the search
type global variable where the
Name field will be used in
where condition while
generating SQL statement when
the search window function is
called.
15. about_Project(): This function will open an
existing project.txt file that
contains the project description
and it will read the file line by
line and writes the content on
the label.
16. studentRegistration(): This function will create a frame
where all the widget controls
are created where the user can
enter the student information
on click of the submit button, it
will call the validated function
to validate the entered input.
10
the student record is already
present.
19. resetVariable(): This function will reset the
variables to their initial values.
20. recordExistsCheck(): This function will check
whether the EnrollNo of the
student is already present in the
table or not. If the record is
present it will return as 1 if not
it will return as 0.
21. SearchResult(): This function will search
student data based on the
search of the global variable.
22. searchWindow(): Based on the module and search
type the search labels are
dynamically set, and this
function will be called on the
student to delete, edit and
search the student on specific
fields such as EmailID, Name
PhoneNo, and EnrollNo.
If the record is matched it will
call the corresponding module
function or it will display the
record which is not found.
23. studentUpdateRec(): This function updates the
student records by executing
update statements passing the
modified values as a tuple
parameter once the data is
updated successfully an alert
message is displayed.
24. SearchResultData(): This function dynamically sets
the var condition of the SQL
statement based on the search
type global variable value and
fetches the student record from
the student table and populates
the record in corresponding
widget controls.
11
25. studentEditSearchData(): This function will fetch the
student data from the student
table based on EnrollNo and
populate the records in
corresponding widget controls.
26. studentDeleteSearchData(): This function will search the
student based on EnollNo. If
the EnrollNo exists in the
student table it will populate the
record in the corresponding
entry box.
27. studentDeleteRec(): It will delete the student record
from the student table based on
EnrollNo.
28. Student_AllRecView(sortfie It will display all the records
ld): based on the argument value
passed.
29. hide_Frames(): The hide function will hide the
existing frames which are
already opened.
FILES USED
12
TABLES USED
Student Table
S.NO COLUMN DATA SIZE CONSTRAINT DESCRIPTION
NAME TYPE
1. EnrollNo INT 11 NOT NULL Student
PRIMARY KEY Identification
Number.
2. Name VAARCHAR 50 NOT NULL Student Name
13
Login_auth table
S.NO COLUMN DATA TYPE SIZE CONSTRAINT DISCRIPTION
NAME
1. login_id VARCHAR 20 NOT NULL User ID
2. Pwd VARCHAR 20 NOT NULL Password
SOURCE CODE
LOGIN PAGE
(Login.py)
14
#importing modules
from tkinter import *
#from tkinter import ttk
from tkinter.messagebox import showinfo
import mysql.connector as sqltor
from PIL import Image, ImageTk #python -m pip install pillow
15
else:
return 0
#Check the entered username and passwod is not empty and call Authenticate
function
def validateCredential():
if len(var1.get())== 0 or len(var2.get())==0:
showinfo("MESSAGE", f"Please Enter the correct USERNAME and
PASSWORD!")
else:
loginres=Authenticate(var1.get(),var2.get())
if loginres ==1:
showinfo("MESSAGE", f"You have Successfully logged in!")
#to close current window
window.destroy()
import StudentInfoSystem
else:
showinfo("MESSAGE", f"Please Enter the valid Credential!")
#_main_
window = Tk()
#Setting the size of the window
window.geometry('700x700')
window.title("Student Information System")
bg= PhotoImage(file="image_back.png")
#Create a canvas
16
canvas= Canvas(window,width= 700, height= 700)
canvas.pack(expand=True, fill= BOTH)
# Display image
canvas.create_image( 0, 0, image = bg,anchor = "nw")
lb0 = Label(window, text="Student Information System", font=("Verdana Bold",
30))
# Display Buttons
lb0 = canvas.create_text( 10, 10, text="Student Information System",
font=("Verdana Bold", 30),anchor = "nw")
lb1 = canvas.create_text( 190, 70, text="Done By HARSHITHA V ",
font=("Bookman old style bold", 15),anchor = "nw")
lb10 = canvas.create_text( 190, 100, text=" KIRUTHIGA K",
font=("Bookman old style bold", 15),anchor = "nw")
lb11 = canvas.create_text( 190, 130, text=" PARINITHA
MOHANAVELU", font=("Bookman old style bold", 15),anchor = "nw")
#username
lb2 = canvas.create_text( 170, 190, text="USERNAME :", font=("Verdana Bold",
11),anchor = "nw")
var1 = StringVar()
txt1 = Entry(window,width=20, textvariable=var1,font=("Bookman old style
bold", 11))
txt1.place(x=290,y=190)
#password
lb3 = canvas.create_text( 170, 250,text="PASSWORD :", font=("Verdana Bold",
11),anchor = "nw")
17
var2 = StringVar()
txt2 = Entry(window,width=20, show='*',textvariable=var2,font=("Bookman old
style bold", 11))
txt2.place(x=290,y=250)
btn = Button(window, text="LOGIN",font=("Bookman old style bold", 12),
width=30,command=validateCredential)
#btn.place(x=170,y=390)
# Display Buttons
button1_canvas = canvas.create_window( 170, 450,anchor = "nw",window = btn)
#event triggered
window.mainloop()
STUDENT INFORMATION
(StudentInfoSytem.py)
#import modules
import mysql.connector as sqltor
from tkinter import *
import StudentGlobal
import datetime
from datetime import date
from tkinter import *
from tkinter.messagebox import showinfo
18
import re #Regex for patter checking
from tkcalendar import DateEntry # python -m pip install tkcalendar
#install python -m install urllib
import webbrowser
#Email pattern
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
#main Block
19
var_FName= StringVar()
var_s = StringVar()
var_DOB = StringVar()
#DB connection
def db_connect():
global mycon
20
mycon=sqltor.connect(host="localhost",user="root",passwd="",database="student
_information")
if mycon.is_connected()==False:
print('Error Connecting')
else:
print('Connected')
21
#View All Student - Sort student by EnrollNo Ascending order
def sortStudByEnrollAsc():
Student_AllRecView(1)
#View All Student - Sort student by EnrollNo Descending order
def sortStudByEnrollDesc():
Student_AllRecView(2)
#View All Student - Sort student by Name Ascending order
def sortStudByNameAsc():
Student_AllRecView(3)
#View All Student - Sort student by Name Descending order
def sortStudByNameDesc():
Student_AllRecView(4)
#View All Student - Search student by Name
def searchByName():
StudentGlobal.searchType=1
StudentGlobal.moduleType=0
searchWindow()
#View All Student - Search student EnrollNo
def searchByEnrollNo():
StudentGlobal.searchType=2
StudentGlobal.moduleType=0
searchWindow()
#View All Student - Search student EmailID
def searchByEmailID():
StudentGlobal.searchType=3
22
StudentGlobal.moduleType=0
searchWindow()
#View All Student - Search student PhoneNo
def searchByPhoneNo():
StudentGlobal.searchType=4
StudentGlobal.moduleType=0
searchWindow()
#Menu Creation
my_menu= Menu(root,font = ("Verdana", 14))
root.config(menu=my_menu)
23
#SubMenu of Admin setup
adm_menu=Menu(my_menu,tearoff=0)
adm_menu.add_command(label='NEW Student Registration',font=("Bookman old
style bold", 10),command=newRegistration)
adm_menu.add_command(label='EDIT Student',font=("Bookman old style bold",
10),command=editStudent)
adm_menu.add_command(label="DELETE Student",font=("Bookman old style
bold", 10),command=deleteStudent)
adm_menu.add_separator()
adm_menu.add_command(label='EXIT',font=("Bookman old style bold",
10),command=root.destroy)
my_menu.add_cascade(label="ADMIN SETUP",menu=adm_menu)
stud = Menu(my_menu, tearoff=0)
#SubMenu of View All record- Sort
sub_menu_view = Menu(stud, tearoff=0)
sub_menu_view.add_command(label='Sort By ENROLLNO
Asc',font=("Bookman old style bold", 10),command=sortStudByEnrollAsc)
sub_menu_view.add_command(label='Sort By ENROLLNO
Desc',font=("Bookman old style bold", 10),command=sortStudByEnrollDesc)
sub_menu_view.add_command(label='Sort By NAME Asc',font=("Bookman old
style bold", 10),command=sortStudByNameAsc)
sub_menu_view.add_command(label='Sort By NAME Desc',font=("Bookman old
style bold", 10),command=sortStudByNameDesc)
stud.add_cascade(label="VIEW all Student Detail",font=("Bookman old style
bold", 10),menu=sub_menu_view)
stud.add_separator()
#stud.add_command(label="Search")
24
#SubMenu of View All record- Search
sub_menu_sort = Menu(stud, tearoff=0)
sub_menu_sort.add_command(label='By NAME',font=("Bookman old style bold",
10),command=searchByName)
sub_menu_sort.add_command(label='By ENROLL NO',font=("Bookman old style
bold", 10),command=searchByEnrollNo)
sub_menu_sort.add_command(label='By EMAIL ID',font=("Bookman old style
bold", 10),command=searchByEmailID)
sub_menu_sort.add_command(label='By PHONE NO',font=("Bookman old style
bold", 10),command=searchByPhoneNo)
stud.add_cascade(label="SEARCH",font=("Bookman old style bold",
10),menu=sub_menu_sort)
#SubMenu of Help
my_menu.add_cascade(label="STUDENT INFO", menu=stud)
help = Menu(my_menu, tearoff=0)
help.add_command(label="ABOUT",font=("Bookman old style bold",
10),command=about_Project)
help.add_command(label='Tinker Link for Tk',font=("Bookman old style bold",
10),command=help_tinker_link1)
help.add_command(label='Tinker Link for Menu',font=("Bookman old style bold",
10),command=help_tinker_link2)
help.add_command(label='Tinker Link for Textbox',font=("Bookman old style
bold", 10),command=help_tinker_link3)
help.add_command(label='Tinker Link for Frame',font=("Bookman old style
bold", 10),command=help_tinker_link4)
help.add_command(label='Tinker Link for Weburl',font=("Bookman old style
bold", 10),command=help_tinker_link5)
25
my_menu.add_cascade(label="HELP",font=("Bookman old style bold",
10),menu=help)
#username
lb1 = Label(add_stu_frame, text="ENROLL NO :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb1.place(x=20,y=90)
txt1 = Entry(add_stu_frame,width=10,
textvariable=var_RollNo,font=("Bookman old style bold", 10))
txt1.place(x=220,y=90)
lb2 = Label(add_stu_frame, text="NAME :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb2.place(x=20,y=130)
#var_Name= StringVar()
txt2= Entry(add_stu_frame,width=50, textvariable=var_Name,font=("Bookman
old style bold", 10))
26
txt2.place(x=220,y=130)
lb3= Label(add_stu_frame, text="CLASS :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb3.place(x=20,y=170)
OptionMenu(add_stu_frame, var_Class,'1','2','3','4','5','6','7', '8','9',
'10','11','12').place(x=220, y=170, width=70)
lb4 = Label(add_stu_frame, text="SECTION :",font=("Bookman
old style bold", 10),bg="#88E7FA")
lb4.place(x=20,y=210)
#var_Sec= StringVar()
OptionMenu(add_stu_frame, var_Sec, 'A', 'B','C','D','E','F').place(x=220, y=210,
width=70)
lb5 = Label(add_stu_frame, text="DOB :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb5.place(x=20,y=250)
dob = DateEntry(add_stu_frame,
selectmode='day',textvariable=var_DOB,date_pattern='yyyy-MM-
dd',font=("Arial", 12), width=15)
dob.place(x=220, y=250)
lb6 = Label(add_stu_frame, text="GENDER :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb6.place(x=20,y=290)
OptionMenu(add_stu_frame, var_Gender, 'MALE', "FEMALE").place(x=220,
y=290, width=70)
lb7 = Label(add_stu_frame, text="ADDRESS :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb7.place(x=20,y=330)
27
txt7= Entry(add_stu_frame,width=50, textvariable=var_Addr,font=("Bookman
old style bold", 10))
txt7.place(x=220,y=330)
lb8 = Label(add_stu_frame, text="MOBILE NO :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb8.place(x=20,y=370)
txt8= Entry(add_stu_frame,width=10,
textvariable=var_Mobile,font=("Bookman old style bold", 10))
txt8.place(x=220,y=370)
lb9 = Label(add_stu_frame, text="EMAIL ID :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb9.place(x=20,y=410)
txt9= Entry(add_stu_frame,width=50,
textvariable=var_EmailID,font=("Bookman old style bold", 10))
txt9.place(x=220,y=410)
lb10= Label(add_stu_frame, text="TRANSPORT :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb10.place(x=20,y=450)
OptionMenu(add_stu_frame,
var_Transport,'SCHOOL','PRIVATE').place(x=220, y=450, width=100)
lb11= Label(add_stu_frame, text="MOTHER'S NAME :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb11.place(x=20,y=490)
txt11= Entry(add_stu_frame,width=50,
textvariable=var_MName,font=("Bookman old style bold", 10))
txt11.place(x=220,y=490)
lb12 = Label(add_stu_frame, text="FATHER'S NAME :", font=("Bookman
old style bold", 10),bg="#88E7FA")
lb12.place(x=20,y=530)
28
txt12= Entry(add_stu_frame,width=50,
textvariable=var_FName,font=("Bookman old style bold", 10))
txt12.place(x=220,y=530)
btn = Button(add_stu_frame, text="SUBMIT",font=("Bookman old style bold",
10), width=30,command=registerStudent)
btn.place(x=220,y=620)
#End AddStudent
#Email Validation done by Regix pattern
def checkEmail(email):
# pass the regular expression
# and the string into the fullmatch() method
if(re.fullmatch(regex, email)):
print("Valid Email")
return 1
else:
print("Invalid Email")
return 0
29
else:
print('Connected')
v=0
30
#Duplicate check.when entered Enrollno is already present in Student table
#Display Error Message otherwise allow to insert in Student table
if v==0:
tuple1=(var_RollNo.get(),)
cursor=mycon.cursor()
cursor.execute("select * from student where EnrollNo=%s",tuple1)
data=cursor.fetchall()
count=cursor.rowcount
if count >0 :
showinfo("Error", f"Student EnrollNo Already Exist !")
elif count==0 :
cursor=mycon.cursor()
tuple1=(var_RollNo.get(),var_Name.get(),var_Class.get(),var_Sec.get(),var_DOB.
get(),var_Gender.get(),var_Addr.get(),var_Mobile.get(),var_EmailID.get(),var_Tra
nsport.get(),var_MName.get(),var_FName.get())
cursor.execute("insert into student values(%s,%s,%s,%s,%s,%s,%s,%s,%s,
%s,%s,%s)",tuple1)
mycon.commit()
showinfo("Message", f"Student Data Inserted Successfully !")
mycon.close()
else:
showinfo("Message", f"Enter Valid Data!")
resetVariable()
#End
#Reset the variable to empty value
31
def resetVariable():
for i in ['var_RollNo',
'var_Name',
'var_Class',
'var_Sec',
'var_DOB',
'var_Gender',
'var_Addr',
'var_Mobile',
'var_EmailID',
'var_Transport',
'var_MName',
'var_FName']:
exec(f"{i}.set('')")
32
#Generate Sql based on searchtype and Moduletype
if StudentGlobal.moduleType==1 or StudentGlobal.moduleType==2:
sql="select * from student where enrollno =%s"
if StudentGlobal.searchType ==1:
sql="select * from student where name =%s"
elif StudentGlobal.searchType ==2:
sql="select * from student where enrollno =%s"
elif StudentGlobal.searchType ==3:
sql="select * from student where Emailid =%s"
elif StudentGlobal.searchType ==4:
sql="select * from student where Phoneno =%s"
#set value in tuple1
tuple1=(searchVal,)
cursor=mycon.cursor()
cursor.execute(sql,tuple1)
data=cursor.fetchall()
count=cursor.rowcount
mycon.close()
if count==0 :
showinfo("ERROR", f"Student Detail Does Not Exist !")
return 0
else:
return 1
34
#Search window function is common for delete, edit and search student
def searchWindow():
hide_Frames()
search_window.pack(fill="both",expand=1)
if StudentGlobal.moduleType==2:
lb0 = Label(search_window, text="Delete Student Information",
font=("Verdana Bold", 15),bg='#88E7FA')
lb0.place(x=350,y=10)
elif StudentGlobal.moduleType==1:
lb0 = Label(search_window, text="Edit Student Information ",
font=("Verdana Bold", 15),bg='#88E7FA')
lb0.place(x=350,y=10)
elif StudentGlobal.moduleType==0:
lb0 = Label(search_window, text="Search Student Information",
font=("Verdana Bold", 15),bg='#88E7FA')
lb0.place(x=350,y=10)
else :
lb0 = Label(search_frame, text="Search Student Information",
font=("Verdana Bold", 15),bg='#88E7FA')
lb0.place(x=350,y=10)
if StudentGlobal.searchType ==1:
lb2 = Label(search_window, text="Enter Name :", font=("Verdana Bold",
12),bg='#88E7FA')
lb2.place(x=10,y=140)
elif StudentGlobal.searchType ==2:
lb2 = Label(search_window, text="Enter Enroll No :", font=("Verdana Bold",
12),bg='#88E7FA')
35
lb2.place(x=10,y=140)
elif StudentGlobal.searchType ==3:
lb2 = Label(search_window, text="Enter Email ID :", font=("Verdana Bold",
12),bg='#88E7FA')
lb2.place(x=10,y=140)
elif StudentGlobal.searchType ==4:
lb2 = Label(search_window, text="Enter Phone No :", font=("Verdana
Bold", 12),bg='#88E7FA')
lb2.place(x=10,y=140)
else:
lb2 = Label(search_window, text="Enter Enroll No :", font=("Verdana Bold",
12),bg='#88E7FA')
lb2.place(x=40,y=140)
var_s.set('')
txt1 = Entry(search_window,width=30, textvariable=var_s,font=("Bookman old
style bold", 11))
txt1.place(x=180,y=140)
btn = Button(search_window, text="Search", font=("Bookman old style bold",
12),width=20,command=SearchResult)
btn.place(x=520,y=140)
#End searchWindow
#Edit Student cal the update statement to modify the existing student detail
def studentUpdateRec():
db_connect()
tuple1
=(var_Name.get(),var_Class.get(),var_Sec.get(),var_DOB.get(),var_Gender.get(),v
36
ar_Addr.get(),var_Mobile.get(),var_EmailID.get(),var_Transport.get(),var_MNam
e.get(),var_FName.get(),var_RollNo.get())
cursor=mycon.cursor()
print("studentUpdateRec")
print(var_RollNo.get())
print(var_Name.get())
sql="update student set name =%s,class=%s,section=%s,dob=%s,gender=
%s,address=%s,phoneno=%s,emailid=%s,transport=%s,mothername=
%s,fathername=%s where enrollno =%s"
print(sql)
print(tuple1)
cursor.execute(sql,tuple1)
mycon.commit()
mycon.close()
showinfo("Message", f"Record Updated Successfully!")
37
elif StudentGlobal.moduleType==1:
lb0 = Label(search_frame, text="Edit Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(search_frame, text="Update",
width=30,command=studentUpdateRec)
btn1.place(x=210,y=620)
else:
lb0 = Label(search_frame, text="Search Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(search_frame, text="View", font=("Arial Bold",
15),width=30,command=sortStudByEnrollAsc)
btn1.place(x=210,y=620)
print(StudentGlobal.searchType)
print(StudentGlobal.searchValue)
db_connect()
tuple1 =(StudentGlobal.searchValue,)
cursor=mycon.cursor()
print("Result Page")
if StudentGlobal.searchType ==1:
sql="select * from student where name =%s"
elif StudentGlobal.searchType ==2:
sql="select * from student where enrollno =%s"
elif StudentGlobal.searchType ==3:
38
sql="select * from student where Emailid =%s"
elif StudentGlobal.searchType ==4:
sql="select * from student where Phoneno =%s"
else:
print("Invalid Data")
print(sql)
print(tuple1)
cursor.execute(sql,tuple1)
#Iterate the record and assign the value to widget control
for row in cursor:
for j in range(len(row)):
var_RollNo.set(row[0])
var_Name.set(row[1])
var_Class.set(row[2])
var_Sec.set(row[3])
var_DOB.set(row[4])
var_Gender.set(row[5])
var_Addr.set(row[6])
var_Mobile.set(row[7])
var_EmailID.set(row[8])
var_Transport.set(row[9])
var_MName.set(row[10])
var_FName.set(row[11])
print(var_Mobile.get())
mycon.close()
39
#username
lb1 = Label(search_frame, text="ENROLL NO :", font=("Arial
Bold", 10),bg='#88E7FA')
lb1.place(x=20,y=90)
if StudentGlobal.moduleType==1 :
txt1= Entry(search_frame,width=50,textvariable=var_RollNo,state=
"disabled")
txt1.place(x=220,y=90)
else:
txt1=
Entry(search_frame,width=50,textvariable=var_RollNo,font=("Bookman old style
bold", 10))
txt1.place(x=220,y=90)
40
lb4 = Label(search_frame, text="SECTION :", font=("Arial Bold",
10),bg='#88E7FA')
lb4.place(x=20,y=210)
txt4= Entry(search_frame,width=50, textvariable=var_Sec,font=("Bookman old
style bold", 10))
txt4.place(x=220,y=210)
lb5 = Label(search_frame, text="DOB :", font=("Arial
Bold", 10),bg='#88E7FA')
lb5.place(x=20,y=250)
txt5= Entry(search_frame,width=50, textvariable=var_DOB,font=("Bookman
old style bold", 10))
txt5.place(x=220,y=250)
lb6 = Label(search_frame, text="GENDER :", font=("Arial Bold",
10),bg='#88E7FA')
lb6.place(x=20,y=290)
41
txt8= Entry(search_frame,width=50, textvariable=var_Mobile,font=("Bookman
old style bold", 10))
txt8.place(x=220,y=370)
lb9 = Label(search_frame, text="EMAIL ID :", font=("Arial Bold",
10),bg='#88E7FA')
lb9.place(x=20,y=410)
txt9= Entry(search_frame,width=50,
textvariable=var_EmailID,font=("Bookman old style bold", 10))
txt9.place(x=220,y=410)
lb10= Label(search_frame, text="TRANSPORT :", font=("Arial
Bold", 10),bg='#88E7FA')
lb10.place(x=20,y=450)
txt10= Entry(search_frame,width=50,
textvariable=var_Transport,font=("Bookman old style bold", 10))
txt10.place(x=220,y=450)
lb11= Label(search_frame, text="MOTHER'S NAME :", font=("Arial
Bold", 10),bg='#88E7FA')
lb11.place(x=20,y=490)
txt11= Entry(search_frame,width=50,
textvariable=var_MName,font=("Bookman old style bold", 10))
txt11.place(x=220,y=490)
lb12 = Label(search_frame, text="FATHER'S NAME :", font=("Arial
Bold", 10),bg='#88E7FA')
lb12.place(x=20,y=530)
txt12= Entry(search_frame,width=50,
textvariable=var_FName,font=("Bookman old style bold", 10))
txt12.place(x=220,y=530)
42
#edit
print('Global value')
print(StudentGlobal.moduleType)
#Edit Student search data return the searched record of enrollno where we can able
to modify record
def studentEditSearchData():
hide_Frames()
edit_frame.pack(fill="both",expand=1)
if StudentGlobal.moduleType==2:
lb0 = Label(edit_frame, text="Delete Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn2 = Button(edit_frame, text="Delete",
width=30,command=studentDeleteRec)
btn2.place(x=210,y=620)
elif StudentGlobal.moduleType==1:
lb0 = Label(edit_frame, text="Edit Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(edit_frame, text="Update",
width=30,command=studentUpdateRec)
btn1.place(x=210,y=620)
else:
lb0 = Label(edit_frame, text="Search Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(edit_frame, text="View",
width=30,command=sortStudByEnrollAsc)
43
btn1.place(x=210,y=620)
print(StudentGlobal.searchType)
print(StudentGlobal.searchValue)
db_connect()
tuple1 =(StudentGlobal.searchValue,)
cursor=mycon.cursor()
print("Result Page")
if StudentGlobal.searchType ==1:
sql="select * from student where name =%s"
elif StudentGlobal.searchType ==2:
sql="select * from student where enrollno =%s"
elif StudentGlobal.searchType ==3:
sql="select * from student where Emailid =%s"
elif StudentGlobal.searchType ==4:
sql="select * from student where Phoneno =%s"
else:
print("Invalid Data")
print(sql)
print(tuple1)
cursor.execute(sql,tuple1)
44
var_Name.set(row[1])
var_Class.set(row[2])
var_Sec.set(row[3])
var_DOB.set(row[4])
var_Gender.set(row[5])
var_Addr.set(row[6])
var_Mobile.set(row[7])
var_EmailID.set(row[8])
var_Transport.set(row[9])
var_MName.set(row[10])
var_FName.set(row[11])
print(var_Mobile.get())
mycon.close()
#username
lb1 = Label(edit_frame, text="ENROLL NO :", font=("Arial Bold",
10),bg='#88E7FA')
lb1.place(x=20,y=90)
if StudentGlobal.moduleType==1 :
txt1= Entry(edit_frame,width=50,textvariable=var_RollNo,state= "disabled")
txt1.place(x=220,y=90)
else:
txt1= Entry(edit_frame,width=50,textvariable=var_RollNo,font=("Bookman
old style bold", 10))
45
txt1.place(x=220,y=90)
lb2 = Label(edit_frame, text="NAME :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb2.place(x=20,y=130)
txt2= Entry(edit_frame,width=50, textvariable=var_Name,font=("Bookman old
style bold", 10))
txt2.place(x=220,y=130)
lb3= Label(edit_frame, text="CLASS :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb3.place(x=20,y=170)
txt3= Entry(edit_frame,width=50, textvariable=var_Class,font=("Bookman old
style bold", 10))
txt3.place(x=220,y=170)
lb4 = Label(edit_frame, text="SECTION :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb4.place(x=20,y=210)
46
lb6.place(x=20,y=290)
txt6= Entry(edit_frame,width=50, textvariable=var_Gender,font=("Bookman
old style bold", 10))
txt6.place(x=220,y=290)
lb7 = Label(edit_frame, text="ADDRESS :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb7.place(x=20,y=330)
txt7= Entry(edit_frame,width=50, textvariable=var_Addr,font=("Bookman old
style bold", 10))
txt7.place(x=220,y=330)
lb8 = Label(edit_frame, text="MOBILE NO :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb8.place(x=20,y=370)
txt8= Entry(edit_frame,width=50, textvariable=var_Mobile,font=("Bookman old
style bold", 10))
txt8.place(x=220,y=370)
47
txt10.place(x=220,y=450)
lb11= Label(edit_frame, text="MOTHER'S NAME :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb11.place(x=20,y=490)
txt11= Entry(edit_frame,width=50, textvariable=var_MName,font=("Bookman
old style bold", 10))
txt11.place(x=220,y=490)
lb12 = Label(edit_frame, text="FATHER'S NAME :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb12.place(x=20,y=530)
txt12= Entry(edit_frame,width=50, textvariable=var_FName,font=("Bookman
old style bold", 10))
txt12.place(x=220,y=530)
#edit
print('Global value')
print(StudentGlobal.moduleType)
#Delete Student Search Result
def studentDeleteSearchData():
hide_Frames()
delete_frame.pack(fill="both",expand=1)
if StudentGlobal.moduleType==2:
lb0 = Label(delete_frame, text="Delete Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn2 = Button(delete_frame, text="Delete",
width=30,command=studentDeleteRec)
48
btn2.place(x=210,y=620)
elif StudentGlobal.moduleType==1:
lb0 = Label(delete_frame, text="Edit Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(delete_frame, text="Update",
width=30,command=studentUpdateRec)
btn1.place(x=210,y=620)
else:
lb0 = Label(delete_frame, text="Search Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn1 = Button(delete_frame, text="View",
width=30,command=sortStudByEnrollAsc)
btn1.place(x=210,y=620)
print(StudentGlobal.searchType)
print(StudentGlobal.searchValue)
db_connect()
tuple1 =(StudentGlobal.searchValue,)
cursor=mycon.cursor()
print("Result Page")
if StudentGlobal.searchType ==1:
sql="select * from student where name =%s"
elif StudentGlobal.searchType ==2:
sql="select * from student where enrollno =%s"
49
elif StudentGlobal.searchType ==3:
sql="select * from student where Emailid =%s"
elif StudentGlobal.searchType ==4:
sql="select * from student where Phoneno =%s"
else:
print("Invalid Data")
print(sql)
print(tuple1)
cursor.execute(sql,tuple1)
for row in cursor:
for j in range(len(row)):
var_RollNo.set(row[0])
var_Name.set(row[1])
var_Class.set(row[2])
var_Sec.set(row[3])
var_DOB.set(row[4])
var_Gender.set(row[5])
var_Addr.set(row[6])
var_Mobile.set(row[7])
var_EmailID.set(row[8])
var_Transport.set(row[9])
var_MName.set(row[10])
var_FName.set(row[11])
print(var_Mobile.get())
mycon.close()
50
#username
lb1 = Label(delete_frame, text="ENROLL NO :", font=("Arial Bold",
10),bg='#88E7FA')
lb1.place(x=20,y=90)
if StudentGlobal.moduleType==1 :
txt1= Entry(delete_frame,width=50,textvariable=var_RollNo,state=
"disabled")
txt1.place(x=220,y=90)
else:
txt1=
Entry(delete_frame,width=50,textvariable=var_RollNo,font=("Bookman old style
bold", 10))
txt1.place(x=220,y=90)
lb2 = Label(delete_frame, text="NAME :", font=("Arial Bold",
10),bg='#88E7FA')
lb2.place(x=20,y=130)
txt2= Entry(delete_frame,width=50, textvariable=var_Name,font=("Bookman
old style bold", 10))
txt2.place(x=220,y=130)
lb3= Label(delete_frame, text="CLASS :", font=("Verdana Bold",
10),bg='#88E7FA')
lb3.place(x=20,y=170)
txt3= Entry(delete_frame,width=50, textvariable=var_Class,font=("Bookman
old style bold", 10))
txt3.place(x=220,y=170)
lb4 = Label(delete_frame, text="SECTION :", font=("Arial Bold",
10),bg='#88E7FA')
51
lb4.place(x=20,y=210)
txt4= Entry(delete_frame,width=50, textvariable=var_Sec,font=("Bookman old
style bold", 10))
txt4.place(x=220,y=210)
lb5 = Label(delete_frame, text="DOB :", font=("Arial Bold",
10),bg='#88E7FA')
lb5.place(x=20,y=250)
txt5= Entry(delete_frame,width=50, textvariable=var_DOB,font=("Bookman
old style bold", 10))
txt5.place(x=220,y=250)
lb6 = Label(delete_frame, text="GENDER :", font=("Arial Bold",
10),bg='#88E7FA')
lb6.place(x=20,y=290)
txt6= Entry(delete_frame,width=50, textvariable=var_Gender,font=("Bookman
old style bold", 10))
txt6.place(x=220,y=290)
lb7 = Label(delete_frame, text="ADDRESS :", font=("Arial Bold",
10),bg='#88E7FA')
lb7.place(x=20,y=330)
txt7= Entry(delete_frame,width=50, textvariable=var_Addr,font=("Bookman
old style bold", 10))
txt7.place(x=220,y=330)
lb8 = Label(delete_frame, text="MOBILE NO :", font=("Arial Bold",
10),bg='#88E7FA')
lb8.place(x=20,y=370)
txt8= Entry(delete_frame,width=50, textvariable=var_Mobile,font=("Bookman
old style bold", 10))
txt8.place(x=220,y=370)
52
lb9 = Label(delete_frame, text="EMAIL ID :", font=("Arial Bold",
10),bg='#88E7FA')
lb9.place(x=20,y=410)
txt9= Entry(delete_frame,width=50, textvariable=var_EmailID,font=("Bookman
old style bold", 10))
txt9.place(x=220,y=410)
lb10= Label(delete_frame, text="TRANSPORT :", font=("Arial Bold",
10),bg='#88E7FA')
lb10.place(x=20,y=450)
txt10= Entry(delete_frame,width=50,
textvariable=var_Transport,font=("Bookman old style bold", 10))
txt10.place(x=220,y=450)
lb11= Label(delete_frame, text="MOTHER'S NAME :", font=("Arial
Bold", 10),bg='#88E7FA')
lb11.place(x=20,y=490)
txt11= Entry(delete_frame,width=50,
textvariable=var_MName,font=("Bookman old style bold", 10))
txt11.place(x=220,y=490)
lb12 = Label(delete_frame, text="FATHER'S NAME :", font=("Arial
Bold", 10),bg='#88E7FA')
lb12.place(x=20,y=530)
txt12= Entry(delete_frame,width=50, textvariable=var_FName,font=("Bookman
old style bold", 10))
txt12.place(x=220,y=530)
#edit
print('Global value')
print(StudentGlobal.moduleType)
53
#Student Delete based on enrollno
def studentDeleteRec():
db_connect()
tuple1 =(StudentGlobal.searchValue,)
cursor=mycon.cursor()
print("studentDeleteRec")
print(StudentGlobal.searchValue)
sql="delete from student where enrollno =%s"
print("Valid Data")
print(sql)
print(tuple1)
cursor.execute(sql,tuple1)
mycon.commit()
mycon.close()
showinfo("MESSAGE", f"Record Deleted Successfully!")
54
print('Connected')
if sortfield ==1:
sql ="select * from Student order by EnrollNo asc"
elif sortfield ==2:
sql ="select * from Student order by EnrollNo desc"
elif sortfield ==3:
sql ="select * from Student order by Name asc"
elif sortfield ==4:
sql ="select * from Student order by Name desc"
else:
sql ="select * from Student "
cursor=mycon_s.cursor()
cursor.execute(sql)
e=Label(stud_view_frame,width=10,text='S.NO',borderwidth=2,
relief='ridge',anchor='w',bg='medium sea green',font=("Bookman old style bold",
10))
e.grid(row=0,column=0)
e=Label(stud_view_frame,width=10,text='ENROLL NO',borderwidth=2,
relief='ridge',anchor='w',bg='pale green',font=("Bookman old style bold", 10))
e.grid(row=0,column=1)
e=Label(stud_view_frame,width=10,text='NAME',borderwidth=2,
relief='ridge',anchor='w',bg='medium aquamarine',font=("Bookman old style
bold",10))
e.grid(row=0,column=2)
e=Label(stud_view_frame,width=10,text='CLASS',borderwidth=2,
relief='ridge',anchor='w',bg='medium sea green',font=("Bookman old style
bold",10))
e.grid(row=0,column=3)
55
e=Label(stud_view_frame,width=10,text='SECTION',borderwidth=2,
relief='ridge',anchor='w',bg='pale green',font=("Bookman old style bold",10))
e.grid(row=0,column=4)
e=Label(stud_view_frame,width=10,text='DOB',borderwidth=2,
relief='ridge',anchor='w',bg='medium aquamarine',font=("Bookman old style
bold",10))
e.grid(row=0,column=5)
e=Label(stud_view_frame,width=10,text='GENDER',borderwidth=2,
relief='ridge',anchor='w',bg='medium sea green',font=("Bookman old style
bold",10))
e.grid(row=0,column=6)
e=Label(stud_view_frame,width=10,text='ADDRESS',borderwidth=2,
relief='ridge',anchor='w',bg='pale green',font=("Bookman old style bold",10))
e.grid(row=0,column=7)
e=Label(stud_view_frame,width=10,text='MOBILE NO',borderwidth=2,
relief='ridge',anchor='w',bg='medium aquamarine',font=("Bookman old style
bold",10))
e.grid(row=0,column=8)
e=Label(stud_view_frame,width=10,text='EMAIL ID',borderwidth=2,
relief='ridge',anchor='w',bg='medium sea green',font=("Bookman old style
bold",10))
e.grid(row=0,column=9)
e=Label(stud_view_frame,width=10,text='TRANSPORT',borderwidth=2,
relief='ridge',anchor='w',bg='pale green',font=("Bookman old style bold",10))
e.grid(row=0,column=10)
e=Label(stud_view_frame,width=14,text="MOTHER'S NAME",borderwidth=2,
relief='ridge',anchor='w',bg='medium aquamarine',font=("Bookman old style
bold",10))
e.grid(row=0,column=11)
56
e=Label(stud_view_frame,width=14,text="FATHER'S NAME",borderwidth=2,
relief='ridge',anchor='w',bg='medium sea green',font=("Bookman old style
bold",10))
e.grid(row=0,column=12)
#fg='blue',
i=1
k=1
57
e.grid(row=i, column=j+1)
#print(student[j])
i=i+1
mycon_s.close()
print(i)
#End View All Records
#Hide the Frame
def hide_Frames():
add_stu_frame.pack_forget()
search_window.pack_forget()
edit_frame.pack_forget()
delete_frame.pack_forget()
search_frame.pack_forget()
help_frame.pack_forget()
stud_view_frame.pack_forget()
#Create Frame
add_stu_frame= Frame(root,width=400,height=400,bg="#88E7FA")
search_window= Frame(root,width=550,height=350,bg="#88E7FA")
edit_frame= Frame(root,width=400,height=400,bg="#88E7FA")
delete_frame= Frame(root,width=400,height=400,bg="#88E7FA")
search_frame= Frame(root,width=400,height=400,bg="#88E7FA")
help_frame= Frame(root,width=400,height=400,bg="#88E7FA")
stud_view_frame= Frame(root,width=400,height=400,bg="#88E7FA")
#Trigger the Event
root.mainloop()
58
StudentGlobal.py
global searchType,searchValue,moduleType
Table_Creation.sql
Create database student_information;
use student_information;
create table login_auth(login_id varchar(20),pwd varchar(20));
insert into login_auth values('csc','project');
59
SAMPLE OUTPUTS
LOGIN PAGE
60
MENUS WITH VALIDATION
ADMIN SETUP
61
NEW STUDENT REGISTRATION
62
63
64
65
66
67
68
69
EDIT STUDENT
70
71
DELETE STUDENT
72
73
STUDENT INFO
Sort by ENROLLNO Asc
74
Sort by ENROLLNO Desc
75
Sort by NAME Asc
76
Sort by NAME Desc
77
SEARCH
To search by NAME, ENROLL NO, EMAIL ID, PHONE NO.
78
79
HELP
80
ABOUT
81
CONCLUSION – SCOPE OF EXTENTION OF PROJECT
82
BIBLIOGRAPHY
83