CSC Project

You might also like

You are on page 1of 83

COMPUTER SCIENCE

PROJECT

STUDENT INFORMATION
SYSTEM

BY
HARSHITHA.V
XII ‘D’

1
2
3
ACKNOWLEDGEMENT

I would like to express my sincere thanks to Meena Aunty, Principal

Mrs. S. Amudha lakshmi for their encouragement and support to

work on this Project. I am grateful to my computer science teacher

Mrs. Mala V and to the computer science department for the

constant guidance and support to complete the project.

4
TABLE OF CONTENTS

S.NO TOPIC PAGE NO

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

Python is a general-purpose programming language. It is very easy to learn,


and easy syntax and readability are one of the reasons why developers
switch to python from programming languages. We can use python as an
object-oriented and procedure-oriented language as well. It is open source
and has tons of libraries for various implementations. Python is a high-level
interpreted language, which is best suited for writing python scripts for
automation and code reusability. It was created in 1991 by Guido Va
Rossum. The origin of the name was inspired by the comedy series called
'Monty python'. Working with python gives us endless possibilities. We can
use python in data science, machine, Artificial intelligence, learning, web
development, software development, etc. To work with any programming
language, you must be familiar with an IDE. You can find the setup for an
IDE for python, on 'python.org' and install it after you have installed
python on your system, you are all set to write programs language in
python programming.

6
PROJECT DESCRIPTION

A Student Information System or SIS is a desktop application. This project


aims to provide a simple interface for the maintenance of student
information efficiently and helps schools /institutes to maintain student
data for easier management and better clarity.
This is a GUI-based Student Information System Project, developed using
MySQL, tkcalendar, message box, DateTime, re(regex) for pattern
validation, web browser for URL links, PIL for photo image, Widgets such
as Entry box, Button, Frame, Canvas and Ttk modules of the Tkinter
library.

FEATURES OF STUDENT INFORMATION SYSTEM

The basic task to be performed on this project are:


1. Register New Student details
2. Edit the existing Student details
3. Delete the Student's details
4. View All student details such as Enroll no, Name, Class, Section,
Gender, Email-id, Contact no, Date of birth, Mother’s name, Father’s name
& Transport.

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

S.NO FUNCTION NAME PURPOSE/USEA


1. Authenticate(loginid,pwd): This function will validate the
entered username and
password from the login_auth
table. When the username and
password match, it will redirect
to the student info page or
otherwise will display an error
page.
1. validateCredential(): This function will check if the
entered username and
password are not empty, if it is
not empty it will call the
authenticate function to
validate the credential from the
database.
2. help_tinker_link(): This function will open the help
menu.
3. db_connect(): This function can be called
whenever we need to connect to
the database.
4. newRegistration(): To register new students’
information this function is
used.
5. editStudent(): This function will set the global
variable to identify the module
type and the search window
function is called to search the
student based on EnrollNo.
6. deleteStudent(): This function will set the global
variable to identify the module
type and the search window
function is called to search the
student based on EnrollNo.

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.

17. checkEmail(email): This function will do the email


validation by using the regex
pattern if the entered EmailID
matches with a pattern it will
return as 1 otherwise it will
return as 0.
18. registerStudent(): This function will validate the
entered new student record. If
the validation is a success it will
check the entered data of the
EnrollNo is already present in
the table by calling the duplicate
check function.
If the record is not present in
the table it will insert into the
student table by calling insert
statement otherwise it will
display an error message that

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

S.NO FILE NAME DISCRIPTION


1. Login.py This file contains the first page where
the user authentication happens.
2. StudentInfoSystem.py This is the core file of Student
Information system where all the
features are written as user defined
function which is in readable format.
3. StudentGlobal.py This file contains the global variables
which is used in this project.

4. Table_Creation.sql This files is used to create database


and table for this project.

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

3. Class INT NOT NULL Student class, 1 to 12

5. Section VARCHAR 1 NOT NULL Student section

6. DOB DATE NOT NULL Student date of birth


in the format
yyyy/mm/dd
7. Gender VARCHAR 6 NOT NUL Student
gender ,male/female
8. Address VARCHAR 50 Not null Student residential
address
9. Phoneno BIGNT 10 NOT NULL Student mobile
number in 10 digits

10. Emailid VARCHAR 50 NOT NULL Student email ID


should have a dot and
@ symbol
11. Transport VARCHAR 20 NOT NULL Student mode of
travel(school/private)

12. MotherName VARCHAR 50 NOT NULL Mother name

13. Father Name VARCHAR 50 NOT NULL Father 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

3. Login_id PRIMARY KEY Login id

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

#Validate the entered username and passwod in table login_auth


def Authenticate(loginid,pwd):
#DB connection connec to Sstudent_Information database
mycon=sqltor.connect(host="localhost",user="root",passwd="",database="student
_information")
if mycon.is_connected()==False:
print('Error Connecting')
else:
print('Connected')
tuple1=(loginid,pwd)
cursor=mycon.cursor()
cursor.execute("select * from login_Auth where login_id=%s and pwd=
%s",tuple1)
data=cursor.fetchall()
count=cursor.rowcount
mycon.close()
if count==1:
return 1

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

#Root window creation


root=Tk()
root.title("STUDENT INFORMATION SYSTEM")
root.geometry('1250x1250')
root.configure(bg="#88E7FA")
#Variable declaration
var_RollNo = StringVar()
var_Name = StringVar()
var_Class = StringVar()
var_Sec = StringVar()
var_Gender = StringVar()
var_Addr = StringVar()
var_Mobile = StringVar()
var_EmailID = StringVar()
var_Transport = StringVar()
var_MName= StringVar()

19
var_FName= StringVar()
var_s = StringVar()
var_DOB = StringVar()

#Help Mneu reference link


def help_tinker_link1():
get_url=webbrowser.open('https://www.geeksforgeeks.org/python-gui-tkinter/')
#Help Mneu reference link
def help_tinker_link2():
get_url=webbrowser.open('https://www.pythontutorial.net/tkinter/tkinter-
menu/')
#Help Mneu reference link
def help_tinker_link3():
get_url=webbrowser.open('https://www.tutorialspoint.com/python/tk_entry.htm')
#Help Mneu reference link
def help_tinker_link4():
get_url=webbrowser.open('https://www.tutorialspoint.com/how-to-switch-
between-two-frames-in-tkinter')
#Help Mneu reference link
def help_tinker_link5():
get_url=webbrowser.open('https://linuxhint.com/open-url-python/')

#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')

#AdminSetup - New student Registration is called


def newRegistration():
studentRegistration()
#AdminSetup - Edit student Registration is called
def editStudent():
#Set global variable to identity the Module as Edit
#Search Type is set to change lable dynamically
StudentGlobal.searchType=2
StudentGlobal.moduleType=1
#Student enroll no search is done by calling searchwindow function
searchWindow()
#AdminSetup - Delete student Registration is called
def deleteStudent():
#Set global variable to identity the Module asDelete
#Search Type is set to change lable dynamically
StudentGlobal.moduleType=2
StudentGlobal.searchType=2
#Student enroll no search is done by calling searchwindow function
searchWindow()

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()

#Help - About Project


def about_Project():
hide_Frames()
help_frame.pack(fill="both",expand=1)
proj_cont=''
with open('ProjectDetail.txt','r') as file:
# reading each line
for line in file:
proj_cont = proj_cont + line
print(proj_cont)
label2= Label(help_frame, text= proj_cont, bd=1, relief= "solid",font=
("Helvetica 10"), justify= LEFT)
label2.place(x=10,y=10)

#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)

#Student Registration page loaded to capture all student details


def studentRegistration():
#Start Add Student Registration
hide_Frames()
add_stu_frame.pack(fill="both",expand=1)
resetVariable()
lb0 = Label(add_stu_frame, text="NEW REGISTRATION", font=("Verdana
Bold", 15),bg='#88E7FA')
lb0.place(x=350,y=10)

#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

#New Student Registration Validation


def registerStudent():
print("student value")
mycon=sqltor.connect(host="localhost",user="root",passwd="",database="student
_information")
if mycon.is_connected()==False:
print('Error Connecting')

29
else:
print('Connected')
v=0

#check the field is empty.When emtry throw error message


if len(var_RollNo.get())== 0 or var_RollNo.get().isnumeric()==False :
showinfo("MESSAGE", f"Enter Only Digit for ENROLL NO!")
v=v+1
if len(var_Mobile.get())== 0 or var_Mobile.get().isnumeric()==False or
len(var_Mobile.get()) <10 :
showinfo("MESSAGE", f"Enter Valid MOBILE NO!")
v=v+1
if len(var_EmailID.get())== 0 or checkEmail(var_EmailID.get()) ==0:
showinfo("MESSAGE", f"Enter Valid EMAIL ID!")
v=v+1
if len(var_Class.get())== 0 or var_Class.get().isnumeric()==False:
showinfo("MESSAGE", f"Enter Valid CLASS NO! ")
v=v+1
if len(var_Sec.get())== 0 or len(var_Sec.get()) >1 or
var_Sec.get().isalpha()==False:
showinfo("MEESAGE", f"Enter Valid SECTION A-N! ")
v=v+1
if len(var_Name.get())== 0 or var_Name.get().isalpha()==False:
showinfo("MESSAGE", f"Enter Valid NAME! ")
v=v+1

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('')")

#Searchby EnrollNo and check if enrollno is already present in student table


def recordExistsCheck():
searchVal=var_s.get()
print("search value")
print(searchVal)
mycon=sqltor.connect(host="localhost",user="root",passwd="",database="student
_information")
if mycon.is_connected()==False:
print('Error Connecting')
else:
print('Connected')

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

#Call Edit and Delete student module based on moduletype


33
def SearchResult():
searchVal=var_s.get()
print("search value ..1")
print(searchVal)
if len(searchVal)== 0 :
showinfo("Message", f"Please Enter the correct Value")
else:
StudentGlobal.searchValue =searchVal
print("Global value:")
print(StudentGlobal.searchValue)
print(StudentGlobal.searchType)
recStatus=recordExistsCheck()
print("recStatus")
print(recStatus)
if StudentGlobal.moduleType==1 and recStatus==1:
#Edit StudentData
studentEditSearchData()
elif StudentGlobal.moduleType==2 and recStatus==1:
#Delete StudentData
studentDeleteSearchData()
elif (StudentGlobal.searchType ==1 or StudentGlobal.searchType ==2
or StudentGlobal.searchType ==3 or StudentGlobal.searchType ==4) and
recStatus ==1:
#Sort Data
SearchResultData()

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!")

#Student search result detail displayed by calling SearchResultData function


def SearchResultData():
hide_Frames()
search_frame.pack(fill="both",expand=1)
if StudentGlobal.moduleType==2:
lb0 = Label(search_frame, text="Delete Student Data", font=("Arial Bold",
15),bg='#88E7FA')
lb0.place(x=350,y=10)
btn2 = Button(search_frame, text="Delete",
width=30,command=studentDeleteRec)
btn2.place(x=210,y=620)

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)

lb2 = Label(search_frame, text="NAME :", font=("Arial Bold",


10),bg='#88E7FA')
lb2.place(x=20,y=130)
txt2= Entry(search_frame,width=50, textvariable=var_Name,font=("Bookman
old style bold", 10))
txt2.place(x=220,y=130)
lb3= Label(search_frame, text="CLASS :", font=("Arial Bold",
10),bg='#88E7FA')
lb3.place(x=20,y=170)
txt3= Entry(search_frame,width=50, textvariable=var_Class,font=("Bookman
old style bold", 10))
txt3.place(x=220,y=170)

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)

txt6= Entry(search_frame,width=50, textvariable=var_Gender,font=("Bookman


old style bold", 10))
txt6.place(x=220,y=290)
lb7 = Label(search_frame, text="ADDRESS :", font=("Arial Bold",
10),bg='#88E7FA')
lb7.place(x=20,y=330)
txt7= Entry(search_frame,width=50, textvariable=var_Addr,font=("Bookman
old style bold", 10))
txt7.place(x=220,y=330)
lb8 = Label(search_frame, text="MOBILE NO :", font=("Arial Bold",
10),bg='#88E7FA')
lb8.place(x=20,y=370)

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)

#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])

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)

txt4= Entry(edit_frame,width=50, textvariable=var_Sec,font=("Bookman old


style bold", 10))
txt4.place(x=220,y=210)
lb5 = Label(edit_frame, text="DOB :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb5.place(x=20,y=250)
txt5= Entry(edit_frame,width=50, textvariable=var_DOB,font=("Bookman old
style bold", 10))
txt5.place(x=220,y=250)
lb6 = Label(edit_frame, text="GENDER :",font=("Bookman old
style bold", 10),bg='#88E7FA')

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)

lb9 = Label(edit_frame, text="EMAIL ID :",font=("Bookman old


style bold", 10),bg='#88E7FA')
lb9.place(x=20,y=410)
txt9= Entry(edit_frame,width=50, textvariable=var_EmailID,font=("Bookman
old style bold", 10))
txt9.place(x=220,y=410)
lb10= Label(edit_frame, text="TRANSPORT :",font=("Bookman old
style bold", 10),bg='#88E7FA')
lb10.place(x=20,y=450)
txt10= Entry(edit_frame,width=50, textvariable=var_Transport,font=("Bookman
old style bold", 10))

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!")

#View All records and sort by Enrollnoor Name


def Student_AllRecView(sortfield):
hide_Frames()
stud_view_frame.pack(fill="both",expand=1)
resetVariable()
mycon_s=sqltor.connect(host="localhost",user="root",passwd="",database="stude
nt_information")
if mycon_s.is_connected()==False:
print('Error Connecting')
else:

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

#Iterate the Records


for student in cursor:
for j in range(len(student)):
#print(j)
if j==0:
e = Label(stud_view_frame,width=10, text=k,
borderwidth=5,relief='ridge', anchor="w",font=("Bookman old style
bold",9),wraplength=80,justify=LEFT)
e.grid(row=i, column=0)
e = Label(stud_view_frame,width=10, text=student[j],
borderwidth=5,relief='ridge',anchor="w",font=("Bookman old style
bold",9),wraplength=80,justify=LEFT)
#Generate the running serial no
k=k+1
else:
e = Label(stud_view_frame,width=10, text=student[j],
borderwidth=5,relief='ridge',anchor="w",font=("Bookman old style
bold",9),wraplength=80,justify=LEFT)
#print(k)

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');

CREATE TABLE student (EnrollNo INT NOT NULL ,


Name VARCHAR(50) NOT NULL ,
Class INT NOT NULL , Section VARCHAR(1) NOT NULL ,
DOB DATE NOT NULL ,
gender VARCHAR(6) NOT NULL ,
Address VARCHAR(150) NOT NULL ,
Phoneno BIGINT(10) NOT NULL ,
emailid VARCHAR(50) NOT NULL ,
Transport VARCHAR(20) NOT NULL ,
MotherName VARCHAR(50) NOT NULL ,
FatherName VARCHAR(50) NOT NULL , PRIMARY KEY (EnrollNo)) ;

CREATE TABLE login_auth (login_id VARCHAR(20) NOT NULL , pwd


VARCHAR(20) NOT NULL , PRIMARY KEY (login_id)) ;

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

This project once developed will help the school/institute to manage


various details pertaining to its students. This will help administration
department in maintaining student’s basic details as well as keeping check
on fees details.

SCOPE FOR EXTENTION

System Information System can further be developed to provide


capabilities for:

 Registering students in courses


 Documenting grading
 Transcripts of academic achievement
 co-curricular activities
 Results of student assessment scores
 Tracking student attendance
 Generating reports

and managing other student-related data needs in an educational


institution

82
BIBLIOGRAPHY

S.NO URL LINKS


1. https://www.geeksforgeeks.org/python-gui-tkinter/
2. https://www.pythontutorial.net/tkinter/tkinter-menu/
3. https://www.tutorialspoint.com/python/tk_entry.htm
4. https://www.tutorialspoint.com/how-to-switch-between-two-
frames-in-tkinter
5. https://linuxhint.com/open-url-python/

83

You might also like