Kendriya Vidyalaya Iit Kharagpur: Compuer Science Investigatory Project
Kendriya Vidyalaya Iit Kharagpur: Compuer Science Investigatory Project
2019-20
COMPUER SCIENCE INVESTIGATORY PROJECT
Z
Z
1) INTRODUCTION
2) SOURCE CODE
3) OUTPUT
4) BIBLIOGRAPHY
Z
HELLO!!
This project is made by three of us. It is
basically used for library management.
It is made by usingPYTHON
programming language and MYSQL
database. Here we have use simple
python languagewith tkinter
frameworks and at the back storing the
data in the mysql database.
'''
This is a Project on Library Issue System useingTkinter
Z
'''
#=========================MODULES================================
from tkinter import *
from tkinter import ttk
import random
from datetime import datetime
import tkinter.messagebox
import mysql.connector as ms
import datetime
#==========================ROOT==================================
root=Tk()
root.geometry("1350x850")
root.title("LIBRARY ISSUE SYSTEM")
#========================STARTING==========================
defmain():
'''
This is the First Page of the Screen
'''
Pass=StringVar()
#====================FRAMES==================================
FullFrame = Frame(root)
FullFrame.grid()
#==================LABELS====================================
Title = Label(TopFrame,width =39,font=("arial",40,"bold"),text='\tWelcome To Library\t')
Z
Title.grid()
defPassWd():
'''
It confirms our Password.
'''
if Pass.get()=="sar123":
page()
else:
Pass.set("")
ErrorPass= tkinter.messagebox.showinfo("Library Management system","IncorrectPassWord !")
defiCut():
'''
It will close the whole window
'''
root.destroy()
defpage():
'''
This is the actual place where issue takes place
'''
#=======================DESTROYING==================
FullFrame.destroy()
TopFrame.destroy()
AskFrame.destroy()
ButtonFrame1.destroy()
#==========================REAL PAGE START=============
MType=StringVar()
Ref=StringVar()
Title=StringVar()
Firstname=StringVar()
Surname=StringVar()
Address1=StringVar()
Z
Address2=StringVar()
PostCode=StringVar()
MobileNo=StringVar()
BookID=StringVar()
BookTitle=StringVar()
BookType=StringVar()
Author=StringVar()
DateBorrowed=StringVar()
DateDue=StringVar()
SellingPrice=StringVar()
LateReturnFine=StringVar()
DateOverDue=StringVar()
DaysOnLoan=StringVar()
Priscription=StringVar()
defiReset():
'''
This will erase the existing data to write freshly
'''
MType.set("")
Ref.set("")
Title.set("")
Firstname.set("")
Surname.set("")
Address1.set("")
Address2.set("")
PostCode.set("")
MobileNo.set("")
BookID.set("")
BookTitle.set("")
BookType.set("")
Author.set("")
DateBorrowed.set("")
DateDue.set("")
SellingPrice.set("")
LateReturnFine.set("")
DateOverDue.set("")
DaysOnLoan.set("")
Priscription.set("")
txtFrameDetail.delete("1.0",END)
Z
defiExit():
'''
It will close the whole frame
'''
iExit = tkinter.messagebox.askyesno("Library Management system","conferm if You want To Exit")
if iExit>0:
root.destroy()
return
defBackPage():
'''
It will return to the main page
'''
MainFrame.destroy()
TitleFrame.destroy()
ButtomFrame.destroy()
DataFrame.destroy()
main()
#========================CONNECTOR===========================
defSave():
'''
It will save all the data to the mysql database
'''
if "" not in [MType.get(),Ref.get(),Title.get(),Firstname.get(),Surname.get(),Address1.get(),
Address2.get(),PostCode.get(),MobileNo.get(),BookID.get(),BookTitle.get(),BookType.get(),
Author.get(),DateBorrowed.get(),DateDue.get(),DaysOnLoan.get(),LateReturnFine.get(),
DateOverDue.get(),SellingPrice.get(),Priscription.get()]:
save = tkinter.messagebox.askyesno("Library Management system","Do you want to save?")
if save>0:
md=ms.connect(host='localhost',user='root',passwd='1234',database='lib')
mcr=md.cursor()
str="insert into libraryissuevalues('{}','{}','{}','{}','{}','{}','{}','{}','{}',\
'{}','{}','{}',\
'{}','{}','{}',\
'{}','{}','{}','\
{}','{}')".format(MType.get(),Ref.get(),Title.get(),Firstname.get(),Surname.get(),Address1.get(),
Address2.get(),PostCode.get(),MobileNo.get(),BookID.get(),BookTitle.get(),BookType.get(),
Author.get(),DateBorrowed.get(),DateDue.get(),DaysOnLoan.get(),LateReturnFine.get(),
DateOverDue.get(),SellingPrice.get(),Priscription.get())
Z
mcr.execute(str)
md.commit()
md.close()
#========================FRAMES==============================
MainFrame = Frame(root)
MainFrame.grid()
ButtomFrame = Frame(MainFrame,bd=3,width=1350,height=50,relief=RIDGE)
ButtomFrame.pack(side=BOTTOM)
DataFrame = Frame(MainFrame,bd=3,width=1300,height=400,relief=RIDGE)
DataFrame.pack(side=BOTTOM)
DataFrameLEFT =
LabelFrame(DataFrame,bd=3,width=800,height=300,relief=RIDGE,font=("arial",12,"bold"),text='Library
Membership info:')
DataFrameLEFT.pack(side=LEFT)
DataFrameRIGHT =
LabelFrame(DataFrame,bd=3,width=450,height=300,relief=RIDGE,font=("arial",12,"bold"),text='Book
Details :')
DataFrameRIGHT.pack(side=RIGHT)
#=========================WIGETS==============================
cboMemberType =
ttk.Combobox(DataFrameLEFT,font=('arial',12,'bold'),state='readonly',width=23,textvariable = MType)
cboMemberType['value']=('','Student','Lecturer','Admin','Staff')
Z
cboMemberType.current(0)
cboMemberType.grid(row=0,column=1)
cboTitle= ttk.Combobox(DataFrameLEFT,font=('arial',12,'bold'),state='readonly',width=23,textvariable =
Title)
cboTitle['value']=('','Mr.','Miss.','Mrs.','Dr.','Cap.')
cboTitle.current(0)
cboTitle.grid(row=2,column=1)
txtMobileNo.grid(row=8,column=1)
#=========================WIDGET=====F2=================
txtFrameDetail = Text(DataFrameRIGHT,font=('arial',12,'bold'),width= 32,height=13)
txtFrameDetail.grid(row=0,column=2)
#======================lISTofBooks========================
scrollbar = Scrollbar(DataFrameRIGHT)
scrollbar.grid(row=0,column=1,sticky='ns')
defSelectedBook(evt):
'''
Selection of books takes place here with required details
'''
value = str(booklist.get(booklist.curselection()))
w = value
if w == 'cinderella':
BookID.set("ISBN 23456708765")
BookTitle.set("The Great")
Author.set("Paul Parker")
LateReturnFine.set("Rs. 100")
SellingPrice.set("Rs. 500")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'consept of physics':
BookID.set("ISBN 9788177091878")
BookTitle.set("Physics")
Author.set("H.C Verma")
Z
LateReturnFine.set("Rs. 50")
SellingPrice.set("Rs. 350")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'S L Arora':
BookID.set("ISBN 15456708665")
BookTitle.set("Physics Class 12")
Author.set("S L Arora")
LateReturnFine.set("Rs. 150")
SellingPrice.set("Rs. 995")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Organic 12':
BookID.set("ISBN 12348908665")
BookTitle.set("Organic Chmistry")
Author.set("J D LEE")
LateReturnFine.set("Rs. 150")
SellingPrice.set("Rs. 1050")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Physical Chemistry':
Z
BookID.set("ISBN 12569999665")
BookTitle.set("Physical Chemistry")
Author.set("R D Verma")
LateReturnFine.set("Rs. 150")
SellingPrice.set("Rs. 885")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
Z
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Aribian Nights':
BookID.set("ISBN 85238599665")
BookTitle.set("Mystry")
Author.set("J K Rowling")
LateReturnFine.set("Rs. 100")
SellingPrice.set("Rs. 300")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Modern ABC':
BookID.set("ISBN 75241254665")
BookTitle.set("Class 12 Chemystry")
Author.set("S P Jahur")
LateReturnFine.set("Rs. 200")
SellingPrice.set("Rs. 1050")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Aladdin':
BookID.set("ISBN 55242541665")
BookTitle.set("Flying Carpet")
Author.set("Robin")
LateReturnFine.set("Rs. 25")
SellingPrice.set("Rs. 55")
DaysOnLoan.set(14)
Z
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
elif w == 'Cengage':
BookID.set("ISBN 65392541665")
BookTitle.set("JEE MAINS And ADVANCE")
Author.set("D K")
LateReturnFine.set("Rs. 25")
SellingPrice.set("Rs. 55")
DaysOnLoan.set(14)
d1=datetime.date.today()
d2=datetime.timedelta(days=14)
d3= d1+d2
DateBorrowed.set(d1)
DateDue.set(d3)
DateOverDue.set("No")
iReceipt()
booklist = Listbox(DataFrameRIGHT,width=20,height=12,font=("arial",12,"bold"))
booklist.bind('<<ListboxSelect>>',SelectedBook)
booklist.grid(row=0,column=0)
scrollbar.config(command=booklist.yview)
btnExit=Button(ButtomFrame,text='Exit',font=('arial',12,'bold'),width=30,bd=4,command = iExit)
btnExit.grid(row=0,column=2)
Z
btnBack=Button(TitleFrame,text='Back',font=('arial',12,'bold'),width=10,bd=4,command
=BackPage )
btnBack.place(x=0,y=0)
btnSave=Button(ButtomFrame,text='Save',font=('arial',12,'bold'),width=30,bd=4,command = Save)
btnSave.grid(row=0,column=3)
defiReceipt():
#========================BUTTONS=============================
btnIssu=Button(ButtonFrame1,text='Enter',font=('arial',12,'bold'),width=30,bd=4,command= PassWd )
btnIssu.grid(row=0,column=1)
btnCut=Button(TopFrame,text='X',font=('arial',12,'bold'),width=5,bd=4,bg='red',command = iCut)
btnCut.place(x=1190,y=0)
main()
root.mainloop()