Class 12 CS Project - Library Management System
Class 12 CS Project - Library Management System
Class 12 CS Project - Library Management System
—
Computer Science Grade XII
—
Teacher – Mr. Prashant Kumar
Certificate
_________________ _________________
External
_________________
Acknowledgement
2) Current Setup
4) Functionalities Provided
6) Reports Of LMS
7) Software Requirements
8) Hardware Requirements
12) Conclusion
13) Bibliography
Problem statement
Introduction: What is the project about?
In computer system the person has to fill the various forms and
numbers of copies of the forms can be easily generated at a
time.
It is not necessary to create the manifest but we can directly
print it, which saves time.
To assist the staff in capturing the effort spent on their
respective working areas.
To utilize the resources in an efficient manner by increasing
their productivity through automation.
The system generates types of information that can be used for
various purposes.
It satisfies the user requirement.
Easy to understand by the user and operator.
Easy to expand.
Has a good user interface.
Delivered on schedule within the budget.
Functionalities provided by Library Management
Systems:
1) Cataloging of Books
a) Add Book Details -- Add a new book to library
b) Delete Book -- Remove a book from the library
2) Viewing the Data
a) View Book List -- Shows a list of all the books in
the library
b) View Issue List -- Shows a list of books issued to
students/members
3) Management of Issues
a) Issue Book -- Issue a book from the library to a
student/member
b) Return Book -- Return an issued book back to
the library.
Reports of Library Management System:
Hardware Requirements
All the fields such as student, Issues, member are validated and
does not take invalid values.
Avoiding errors in data.
Controlling amount of input.
Integration of all modules/forms in the system.
Preparation of the test cases.
Preparation of the possible test data with all the validation
checks.
Actual testing done manually.
Input/
Output
MySQL sends output via Python User sends data to Python
after executing the commands
MySQL Python
Command Command
Executer Interpreter
def clear():
uname.delete(0, END)
entry.delete(0, END)
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='lib')
if mycon.is_connected():
print('Successfully connected!')
if mycon.is_connected()==False:
print('Error!')
mycon.close()
except:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE lib")
mydb.close()
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database='lib'
)
mycursor = mydb.cursor()
mycursor.execute("create table books(bid varchar(20) primary key, title varchar(30),
author varchar(30), status varchar(30));")
mycursor.execute("create table books_issued(bid varchar(20) primary key, issuedto
varchar(30), issuedate varchar(20));")
print('Database does not exist!\n---------CREATING DATABASE---------\n---------DATABASE
CREATED---------\n---------Rerun the Program---------')
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='login')
if mycon.is_connected():
print('Successfully connected!')
if mycon.is_connected()==False:
print('Error!')
cur=mycon.cursor()
try:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database='login'
)
mycursor = mydb.cursor()
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e not in f:
mycursor.execute("insert into uname values('master','root','y');")
mydb.commit()
else:
print('continue')
except:
print('continue2')
def next1(event):
entry.focus_set()
def next2(event):
enter.focus_set()
win = Tk()
win.geometry("400x200")
password = StringVar()
username = StringVar()
try:
cur.execute("select * from uname")
f=cur.fetchall()
def log():
p = password.get()
u = username.get()
z = ['y','n']
for i in z:
x = (u,p,i)
if x in f:
win.destroy()
if i=='y':
main()
else:
user()
break
else:
ttk.Label(win, text="Wrong Username or Password").pack()
def log2(event):
p = password.get()
u = username.get()
z = ['y','n']
for i in z:
x = (u,p,i)
if x in f:
win.destroy()
if i=='y':
main()
else:
user()
break
else:
ttk.Label(win, text="Wrong Username or Password").pack()
ttk.Label(win, text="Username").pack()
uname = Entry(win, width=25, textvariable=username)
uname.pack(pady=10)
uname.bind('<Return>', next1)
ttk.Label(win, text="Password").pack()
entry = Entry(win, width=25, textvariable=password, show="*")
entry.pack(pady=10)
entry.bind('<Return>', next2)
enter = Button(win, text="Login", command=log)
enter.bind('<Return>', log2)
enter.pack()
ttk.Label(win, text="(Keep hitting Enter to navigate / submit or\n or press button
to submit!)").pack()
win.mainloop()
except:
print('Cannot fetch data from db')
mycon.close()
except:
import mysql.connector
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='login')
mycon.close()
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database='login'
)
mycursor = mydb.cursor()
mycursor.execute("create table uname(uname varchar(30) primary key, pass
varchar(30), trueadmin varchar(1));")
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e in f:
print('continue')
else:
mycursor.execute("insert into uname values('master','root','y');")
print('Database does not exist!\n---------CREATING DATABASE---------\n---------
DATABASE CREATED---------\n---------Rerun the Program---------')
except:
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE login")
mydb.close()
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database='login'
)
mycursor = mydb.cursor()
mycursor.execute("create table uname(uname varchar(30) primary key, pass varchar(30),
trueadmin varchar(1));")
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e in f:
print('continue')
else:
mycursor.execute("insert into uname values('master','root','y');")
print('Database does not exist!\n---------CREATING DATABASE---------\n---------DATABASE
CREATED---------\n---------Rerun the Program---------')
Functions Used:-
AddBook.py
# Book ID to Delete
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.5)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
#Submit Button
SubmitBtn = Button(root,text="Return",bg='#d1ccc0', fg='black',command=returnn)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
ViewBooks.py
from tkinter import *
import mysql.connector as msql
from tkinter import messagebox
mycon=msql.connect(host='localhost', user='root', passwd='root', database='lib')
cur=mycon.cursor()
def View():
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, mycon, cur, bookTable, root
bookTable = "books"
root = Tk()
root.title("Library")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
headingLabel = Label(headingFrame1, text="View Books", bg='black', fg='white', font =
('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
y = 0.25
Label(labelFrame, text="%-10s%-40s%-30s%-20s"%('BID','Title','Author','Status'),
bg='black',fg='white').place(relx=0.07,rely=0.1)
Label(labelFrame, text = "----------------------------------------------------------------------------
",bg='black',fg='white').place (relx=0.05,rely=0.2)
getBooks = "select * from "+bookTable
try:
cur.execute(getBooks)
for i in cur:
Label(labelFrame,text="%-10s%-30s%-30s%-20s"%(i[0],i[1],i[2],i[3]) ,bg='black',
fg='white').place(relx=0.07,rely=y)
y += 0.1
mycon.commit()
except:
messagebox.showinfo("Error","Failed to fetch files from database")
def export():
ex='select * from books'
cur.execute(ex)
l=cur.fetchall()
fh=open(".//Exports//data.txt","w")
for i in l:
i=str(i)+'\n'
fh.write(str(i))
messagebox.showinfo("Success","File exported to CS_Project/Exports/data.txt")
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.6,rely=0.9, relwidth=0.18,relheight=0.08)
exBtn = Button(root,text="Export",bg='#f7f1e3', fg='black', command=export)
exBtn.place(relx=0.2,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
Output
Login:
Add Books:
Delete Book:
View Books:
Issue List:
Issue Books:
Return Book:
2) google.com
3) slideshare.in
4) github.com
THANK YOU