You are on page 1of 16

KENDRIYA VIDYALAYA EOI

KATHMANDU

A Project Report

On

STUDENT DETAILS MANAGEMENT SYSTEM

For

As a part of the Class XI Informatics Practices (065)


SUBMITTED BY:

PRANAV PRATAP SINGH

11208

Under the Guidance of:

Amit Dave
CERTIFICATE
This is to certify that Pranav Pratap Singh, a student of Class XI B has
successfully completed the project on “Student Details Management
System” mentioned under the guidance of Sh. Amit Dave (PGT
Comp.Sc.) during the year 2018-19 in partial fulfillment of
Informatics Practices Practical Examination.

Amit Dave
Subject Teacher

R. SANKAR
PRINCIPAL
ACKNOWLEDGEMENT

I would like to extend my sincere and heartfelt gratitude to


my informatics practices teacher Mr. Amit Dave who gave
me the golden opportunity to do this wonderful project on
the topic “Student Details Management System”, he has
helped me in this endeavor and has always been very
cooperative and without his help, cooperation, guidance and
encouragement, the project couldn't have been what it
evolved to be. I also thank my principal Mr. R. SANKAR who
is always there for his guidance and encouragement.

At last but not least, gratitude to my teammate (Shruti


Thapa) who along with me worked hard to complete this
project within a limited time frame.

Pranav Pratap Singh


Class XI B
OVERVIEW OF PYTHON
Python is a high-level, interpreted, interactive and object-oriented
scripting language. Python is designed to be highly readable. It uses
English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other
languages.
 Python is Interpreted − Python is processed at runtime by the
interpreter. You do not need to compile your program before executing
it. This is similar to PERL and PHP.
 Python is Interactive − You can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
 Python is Object-Oriented − Python supports Object-Oriented style or
technique of programming that encapsulates code within objects.
 Python is a Beginner's Language − Python is a great language for the
beginner-level programmers and supports the development of a wide
range of applications from simple text processing to WWW browsers to
games.

History of Python
Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics
and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC,
Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and other
scripting languages.
Python is copyrighted. Like Perl, Python source code is now available
under the GNU General Public License (GPL).
Python is now maintained by a core development team at the
institute, although Guido van Rossum still holds a vital role in
directing its progress.

Python Features
Python's features include −
 Easy-to-learn − Python has few keywords, simple structure, and a
clearly defined syntax. This allows the student to pick up the language
quickly.
 Easy-to-read − Python code is more clearly defined and visible to the
eyes.
 Easy-to-maintain − Python's source code is fairly easy-to-maintain.
 A broad standard library − Python's bulk of the library is very portable
and cross-platform compatible on UNIX, Windows, and Macintosh.
 Interactive Mode − Python has support for an interactive mode which
allows interactive testing and debugging of snippets of code.
 Portable − Python can run on a wide variety of hardware platforms and
has the same interface on all platforms.
 Extendable − You can add low-level modules to the Python interpreter.
These modules enable programmers to add to or customize their tools
to be more efficient.
 Databases − Python provides interfaces to all major commercial
databases.
 GUI Programming − Python supports GUI applications that can be
created and ported to many system calls, libraries and windows
systems, such as Windows MFC, Macintosh, and the X Window system
of Unix.
 Scalable − Python provides a better structure and support for large
programs than shell scripting.
Apart from the above-mentioned features, Python has a big list of
good features, few are listed below −
 It supports functional and structured programming methods as well as
OOP.
 It can be used as a scripting language or can be compiled to byte-code
for building large applications.
 It provides very high-level dynamic data types and supports dynamic
type checking.
 It supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

ABOUT THE PROJECT


This project has been made to demonstrate simple
student details management system via python. It is a
program which allows the user to enjoy the benefits of
adding, viewing, deleting, updating and searching
student records.
While adding the details of the student, the user has to
provide name, father’s name, mother’s name, D.O.B,
contact no., email and admission no. and if any of
these is unknown it can be left blank and later be
updated. After a record has been added, the system
shows the student details in a list view. For updating
the records, the user has to view all records, click on a
record that he/she wishes to edit, change the
necessary details and press the update button. And
also the user can easily delete any student record.
The last feature is about searching. Simply by entering
any of the details, a user can search for the required
student record. This GUI based Student details
management system provides the simplest
management of Student details. In short, this project is
totally based on CRUD (create, read, update, delete).
There’s an external database connection file used in
this mini project, in order to store user’s data
permanently. The project file contains a database file
and python script (main_page.py).

ALGORITHM
main_page.py
1. Start
2. Import the tkinter module
3. Import the module sub(self-created module containing linkage with
database)
4. Create the main window(container)
5. Define the commands required in the program:

a) view_command e)update_command
b) search_command f) delete_command
c) add_command g)clear_command
d) get_selected_row

6. Create a table like form using grid method and label each row
7. Create entry box in each row specifying the type of data to be
entered
8. Create buttons for different commands required in the program and
link them to their respective functions defined earlier.
9. Create a list box to display necessary details.
10. Stop
sub.py
1. Start
2. Import sqlite3
3. Define the following functions to create and make changes in the
database
a) create-to create the database if not present
b) viewwall- to display all the records of the database
c) search- to search the required record in the database
d) add- to add new records in the database
e) update- to update the fields of existing records
f) delete- to delete the required records from the database
4. Stop

CODE
(main_page.py)
#Simple student details management system
# Developed By: Pranav Pratap Singh & Shruti Thapa (Class-11B)

from tkinter import *


import sub
window = Tk()
window.title("Student Details Management")

def view_command():
lb.delete(0,END)
for row in sub.viewall():
lb.insert(END,row)

def search_command():
lb.delete(0,END)
for row in
sub.search(name=name.get(),fname=fname.get(),mname=mname.get(),dob=d
ob.get(),contact=contact.get(),email=email.get(),admno=admno.get()):
lb.insert(END,row)

def add_command():

sub.add(name.get(),fname.get(),mname.get(),dob.get(),contact.get(),email.get
(),admno.get())
lb.delete(0,END)

lb.insert(END,name.get(),fname.get(),mname.get(),dob.get(),contact.get(),ema
il.get(),admno.get())

def get_selected_row(event):
try:
global selected_tuple
index=lb.curselection()[0]
selected_tuple = lb.get(index)
e1.delete(0,END)
e1.insert(END,selected_tuple[1])
e2.delete(0,END)
e2.insert(END,selected_tuple[2])
e3.delete(0,END)
e3.insert(END,selected_tuple[3])
e4.delete(0,END)
e4.insert(END,selected_tuple[4])
e5.delete(0,END)
e5.insert(END,selected_tuple[5])
e6.delete(0,END)
e6.insert(END,selected_tuple[6])
e7.delete(0,END)
e7.insert(END,selected_tuple[7])
except IndexError:
pass

def update_command():

sub.update(selected_tuple[0],name=name.get(),fname=fname.get(),mname=
mname.get(),dob=dob.get(),contact=contact.get(),email=email.get(),admno=a
dmno.get())
view_command()

def delete_command():
sub.delete(selected_tuple[0])
view_command()

def clear_command():
lb.delete(0,END)
e1.delete(0,END)
e2.delete(0,END)
e3.delete(0,END)
e4.delete(0,END)
e5.delete(0,END)
e6.delete(0,END)
e7.delete(0,END)

l1 = Label(window,text="Full Name")
l1.grid(row=0,column=0,columnspan=2)
l2 = Label(window,text="Father's Name")
l2.grid(row=1,column=0,columnspan=2)
l3 = Label(window,text="Mother's Name")
l3.grid(row=2,column=0,columnspan=2)
l4 = Label(window,text="D.O.B(DD/MM/YYYY)")
l4.grid(row=3,column=0,columnspan=2)
l5 = Label(window,text="Contact No.")
l5.grid(row=4,column=0,columnspan=2)
l6 = Label(window,text="Email")
l6.grid(row=5,column=0,columnspan=2)
l7 = Label(window,text="Admn No.")
l7.grid(row=6,column=0,columnspan=2)

name=StringVar()
e1 = Entry(window,textvariable=name,width=50)
e1.grid(row=0,column=0,columnspan=10)

fname=StringVar()
e2 = Entry(window,textvariable=fname,width=50)
e2.grid(row=1,column=0,columnspan=10)

mname=StringVar()
e3 = Entry(window,textvariable=mname,width=50)
e3.grid(row=2,column=0,columnspan=10)

dob=StringVar()
e4 = Entry(window,textvariable=dob,width=50)
e4.grid(row=3,column=0,columnspan=10)

contact=StringVar()
e5 = Entry(window,textvariable=contact,width=50)
e5.grid(row=4,column=0,columnspan=10)

email=StringVar()
e6 = Entry(window,textvariable=email,width=50)
e6.grid(row=5,column=0,columnspan=10)

admno=IntVar()
e7 = Entry(window,textvariable=admno,width=50)
e7.grid(row=6,column=0,columnspan=10)
b1 = Button(window,text="Add",width=12,command=add_command)
b1.grid(row=7,column=0)

b2 = Button(window,text="Update",width=12,command=update_command)
b2.grid(row=7,column=1)

b3 = Button(window,text="Search",width=12,command=search_command)
b3.grid(row=7,column=2)

b4 = Button(window,text="View All",width=12,command=view_command)
b4.grid(row=7,column=3)

b5 = Button(window,text="Delete",width=12,command=delete_command)
b5.grid(row=7,column=4)

b6 = Button(window,text="Exit",width=12,command=window.destroy)
b6.grid(row=7,column=5)

b7 = Button(window,text="Clear All",width=12,command=clear_command)
b7.grid(row=0,column=5)

lb=Listbox(window,height=25,width=110)
lb.grid(row=8,column=0,columnspan=6)

sb=Scrollbar(window)
sb.grid(row=8,column=6,rowspan=6)

lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)

lb.bind('<<ListboxSelect>>',get_selected_row)
window.mainloop()
(sub.py)
import sqlite3
def create():
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS account(id INTEGER PRIMARY
KEY,name TEXT,fname TEXT,mname TEXT,dob TEXT, contact TEXT,email
TEXT,admno INTEGER)")
con.commit()
con.close()
def viewall():
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("SELECT * FROM account")
rows = cur.fetchall()
con.close()
return rows

def
search(name="",fname="",mname="",dob="",contact="",email="",admno=""):
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("SELECT * FROM account WHERE name=? OR fname=? OR
mname=? OR dob=? OR contact=? OR email=? OR admno=?",
(name,fname,mname,dob,contact,email,admno))
rows = cur.fetchall()
con.close()
return rows
def add(name,fname,mname,dob,contact,email,admno):
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("INSERT INTO account VALUES(NULL,?,?,?,?,?,?,?)",
(name,fname,mname,dob,contact,email,admno))
con.commit()
con.close()
def update(id,name,fname,mname,dob,contact,email,admno):
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("UPDATE account SET
name=?,fname=?,mname=?,dob=?,contact=?,email=?,admno=? WHERE id=?",
(name,fname,mname,dob,contact,email,admno,id))
con.commit()
con.close()
def delete(id):
con = sqlite3.connect("sub.db")
cur = con.cursor()
cur.execute("DELETE FROM account WHERE id=?",(id,))
con.commit()
con.close()
create()
OUTPUT SCREEN
1. Initial page

2. Add details
3. View all records

4. Record to be updated
5. Updated record

6. Search results
BIBLIOGRAPHY
1. https://en.wikibooks.org
2. https://www.tutorialspoint.com

3. https://pythonspot.com/python-database-

programming-sqlite-tutorial/
4. https://www.w3schools.com

5. https://www.youtube.com

You might also like