libraryManagment
libraryManagment
A PROJECT REPORT ON
AI LIBRARY MANAGEMENT
SYSTEM IN PYTHON
SUBMITED BY
Name: SADAF KHAN
Session: 2019 -2022
Date: 16-07-2022
Place:Ranchi
S.S. Memorial College, Ranchi
CERTIFICATE
*Abstract
1. INTRODUCTION
1.1 Organization Profile
1.2 AI Library Management System
2. SYSTEM ANALYSIS
2.1 Existing System
2.2 Proposed System
2.3 Feasibility Study
3. MODULE DESCRIPTION
3.1 Add Image
3.2 Construct Image
3.3 Add books
3.4 Issue books Details
3.5 Delete books Details
3.6 View book lists
3.7 Issue books to students
3.8 Return books
4. SYSTEM REQUIREMENTS
4.1 Software Requirements
5. OVERVIEW OF PYTHON
6. MYSQL - INTRODUCTION
7. TESTING
8. IMPLEMENTATION
9. CONCLUSION
10. BIBLIOGRAPHY
INTRODUCTION
Library management systems are designed to manage the
movement of books and maintain records of the members
in a library. The software solution is designed based on
the system requirements, the people involved, the content
of the operation and the activity to be performed.
The final stage is coding for each activity in the case, class
and activity diagrams. This is the most important function
in the design of the library management system software.
SYSTEM ANALYSIS
SYSTEM ANALYSIS EXISTING SYSTEM:
System Analysis is a detailed study of the various operations
performed by a system and their relationships within and
outside of the system. Here the key question is- what all
problems exist in the present system? What must be done to
solve the problem? Analysis begins when a user or manager
begins a study of the program using existing system. During
analysis, data collected on the various files, decision points and
transactions handled by the present system. The commonly
used tools in the system are Data Flow Diagram, interviews,
etc. Training, experience and common sense are required for
collection of relevant information needed to develop the
system. The success of the system depends largely on how
clearly the problem is defined, thoroughly investigated and
properly carried out through the choice of solution. A good
analysis model should provide not only the mechanisms of
problem understanding but also the frame work of the solution.
Thus it should be studied thoroughly by collecting data about
the system. Then the proposed system should be analyzed
thoroughly in accordance with the needs. System analysis can
be categorized into four parts. ü System planning and initial
investigation ü Information Gathering ü Applying analysis tools
for structured analysis ü Feasibility study ü Cost/ Benefit
analysis.
FEASIBLITY ANALYSIS
MySQL – Introduction
What is a Database?
A database is a separate application that stores a
collection of data. Each database has one or more distinct
APIs for creating, accessing, managing, searching and
replicating the data it holds.
Other kinds of data stores can also be used, such as files
on the file system or large hash tables in memory but data
fetching and writing would not be so fast and easy with
those type of systems.
Nowadays, we use relational database management
systems (RDBMS) to store and manage huge volume of
data. This is called relational database because all the data
is stored into different tables and relations are established
using primary keys or other keys known as Foreign Keys.
A Relational Database Management System
(RDBMS) is a software that −
Enables you to implement a database with tables,
columns and indexes.
Guarantees the Referential Integrity between
rows of various tables.
Updates the indexes automatically.
Interprets an SQL query and combines
information from various tables.
RDBMS Terminology
Before we proceed to explain the MySQL database
system, let us revise a few definitions related to the
database.
Database − A database is a collection of tables,
with related data.
Table − A table is a matrix with data. A table in
a database looks like a simple spreadsheet.
Column − One column (data element) contains
data of one and the same kind, for example the
column postcode.
Row − A row (= tuple, entry or record) is a group
of related data, for example the data of one
subscription.
Redundancy − Storing data twice, redundantly
to make the system faster.
Primary Key − A primary key is unique. A key
value cannot occur twice in one table. With a
key, you can only find one row.
Foreign Key − A foreign key is the linking pin
between two tables.
Compound Key − A compound key (composite
key) is a key that consists of multiple columns,
because one column is not sufficiently unique.
Index − An index in a database resembles an
index at the back of a book.
Referential Integrity − Referential Integrity
makes sure that a foreign key value always points
to an existing row.
MySQL Database
MySQL is a fast, easy-to-use RDBMS being used for
many small and big businesses. MySQL is developed,
marketed and supported by MySQL AB, which is a
Swedish company. MySQL is becoming so popular
because of many good reasons −
MySQL is released under an open-source license.
So you have nothing to pay to use it.
MySQL is a very powerful program in its own
right. It handles a large subset of the functionality
of the most expensive and powerful database
packages.
MySQL uses a standard form of the well-known
SQL data language.
MySQL works on many operating systems and
with many languages including PHP, PERL, C,
C++, JAVA, etc.
MySQL works very quickly and works well even
with large data sets.
MySQL is very friendly to PHP, the most
appreciated language for web development.
MySQL supports large databases, up to 50
million rows or more in a table. The default file
size limit for a table is 4GB, but you can increase
this (if your operating system can handle it) to a
theoretical limit of 8 million terabytes (TB).
MySQL is customizable. The open-source GPL
license allows programmers to modify the
MySQL software to fit their own specific
environments.
Description of Tables
Create Tables
create database db;
create table books(bid varchar(20) primary key, title
varchar(30), author varchar(30), status varchar(30));
create table books_issued(bid varchar(20) primary key, issuedto
varchar(30));
1. books
2. issued_books
mysqld.exe --console
NOTE − If you are on NT, then you will have to use
mysqld-nt.exe instead of mysqld.exe
If all went well, you will see some messages about startup
and inorb. If not, you may have a permissions issue. Make
sure that the directory that holds your data is accessible to
whatever user (probably MySQL) the database processes
run under.
MySQL will not add itself to the start menu, and there is
no particularly nice GUI way to stop the server either.
Therefore, if you tend to start the server by double
clicking the MySQL executable, you should remember to
halt the process by hand by using mysqladmin, Task List,
Task Manager, or other Windows-specific means.
[root@host]# mysql
It should be rewarded with a mysql> prompt. Now, you
are connected to the MySQL server and you can execute
all the SQL commands at the mysql> prompt as follows −
/etc/init.d/mysqld start
Update_priv
Delete_priv
Create_priv
Drop_priv
Reload_priv
Shutdown_priv
Process_priv
File_priv
Grant_priv
References_priv
Index_priv
Alter_priv
mysql> GRANT
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON TUTORIALS.*
-> TO 'zara'@'localhost'
-> IDENTIFIED BY 'zara123';
This will also create an entry in the MySQL database
table called as user.
NOTE − MySQL does not terminate a command until
you give a semi colon (;) at the end of the SQL command.
The /etc/my.cnf File Configuration
In most of the cases, you should not touch this file. By
default, it will have the following entries −
[mysqld]
datadir=/var/lib/mysql
socket =/var/lib/mysql/mysql.sock
[mysql.server]
user =mysql
basedir=/var/lib
[safe_mysqld]
err-log =/var/log/mysqld.log
pid-file =/var/run/mysqld/mysqld.pid
Here, you can specify a different directory for the error
log, otherwise you should not change any entry in this
table.
DFD for Library Management System
Data Flow Diagram (DFD) depicts the flow of information and the
transformation applied when a data moves in and out from a
system. The overall system is represented and described using
input, processing and output in the DFD. The inputs can be:
Book request when a student requests for a book.
Library card when the student has to show or submit his/her
identity as a proof.
The overall processing unit will contain the following output that a
system will produce or generate:
Book will be the output as the book demanded by the student will
be given to them.
Level 0 DFD –
Level 1 DFD –
Level 2 DFD –
Out of scope:
Other activities like purchasing of new books, replacement
of old books or charging a fine are not considered in the
above system.
SOURCE CODE
FRONT PAGE:-
t=Tk()
t.geometry("1600x800+0+0")
t.title("Library Magement System")
t.config(bg="DarkOrange1")
st=Style()
st.configure('W.TButton',font=('Arial!',25,'bold','underline'),foregrou
nd='red',background='black',borderwidth = '4')
img2=Image.open(r"C:\Users\hp\Desktop\logo6.png")
img2=img2.resize((200,100))
img2=ImageTk.PhotoImage(img2)
l=Label(t,image=img2)
l.place(x=5,y=10,width=200,height=100)
#---ICON_IMAGE---
icon1=Label(t)
icon1.place(x=100,y=125)
#------------------Rotaion photo--------------------------
x=1
def a():
global x
img=Image.open(r"libimage\p"+str(x)+".jpg")
img=img.resize((1300,650))
img=ImageTk.PhotoImage(img)
icon1.config(image=img)
icon1.image=img
x=x+1
t.after(1000,a)
if x==7:
x=1
a()
b.place(x=1250,y=730)
LOGIN PAGE:-
import mysql.connector
import mysql.connector as c
import time
import calendar
def lg():
t=Tk()
t.geometry("1600x800+0+0")
t.title("Login!!!")
st=Style()
l=Label(t)
img=Image.open(r"E:\LIB.jpg")
img=img.resize((1600,700))
img=ImageTk.PhotoImage(img)
l.config(image=img)
l.image=img
l.place(x=0,y=105)
titlelbl.config(anchor=CENTER)
titlelbl.place(x=0,y=0,width=1600,height=120)
ll=Label(t)
img2=Image.open(r"C:\Users\hp\Desktop\logo6.png")
img2=img2.resize((200,100))
img2=ImageTk.PhotoImage(img2)
ll.config(image=img2)
ll.image=img2
ll.place(x=5,y=10,width=200,height=100)
lll=Label(t)
img3=Image.open(r"C:\Users\hp\Desktop\logobg.jpg")
img3=img3.resize((800,400))
img3=ImageTk.PhotoImage(img3)
lll.config(image=img3)
lll.image=img3
lll.place(x=385,y=400)
def clock():
h=str(time.strftime("%H"))
m=str(time.strftime("%M"))
s=str(time.strftime("%S"))
dd=str(time.strftime("%d"))
mm=int(time.strftime("%m"))
yy=int(time.strftime("%y"))
lbldate.config(text=dd)
lblmonth.config(text=str(mm))
lblyear.config(text=str(yy))
lblnoon.config(text="PM")
if int(h)>12:
h=str((int(h)-12))
lblhr.config(text=h)
lblmin.config(text=m)
lblsec.config(text=s)
lblhr.after(200,clock)
lblhr=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblhr.place(x=640,y=190,width=60,height=40)
lbldate=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")
lbldate.place(x=640,y=240,width=60,height=40)
lblmin=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblmin.place(x=710,y=190,width=60,height=40)
lblmonth=Label(t,text="Month",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblmonth.place(x=710,y=240,width=60,height=40)
lblsec=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblsec.place(x=780,y=190,width=60,height=40)
lblyear=Label(t,text="Year",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblyear.place(x=780,y=240,width=60,height=40)
lblnoon=Label(t,text="AM",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblnoon.place(x=850,y=190,width=60,height=40)
lblcurrent=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblcurrent.place(x=850,y=240,width=60,height=40)
clock()
#=================Heading content==========
l1.place(x=665,y=410)
#=======TEXT AREA==============
l1=Label(t,text="* User Id
:",font='18',background="black",foreground="red")
l1.place(x=550,y=520)
t1=Entry(t,font="bold")
t1.place(x=700,y=520,width=320)
l2=Label(t,text="* Password
:",font='18',background="black",foreground="red")
l2.place(x=550,y=590)
t2=Entry(t,font="bold")
t2.place(x=700,y=590,width=320)
t2.config(show="*")
#==============MySql connectivity======================
def login():
if t1.get()=="" or t2.get()=="":
messagebox.showerror("Error","All fields are required",parent=t)
else:
try:
con=c.connect(host="localhost",user="root",password="",port="3306",
database="library_db")
cur=con.cursor()
row=cur.fetchone()
if row==None:
loginclear()
t1.focus()
else:
appscreen()
con.close()
def loginclear():
t1.delete(0,END)
t2.delete(0,END)
def appscreen():
main()
#--------------------login Button------------------
u=Label(t)
b=Button(t,image=img)
img=Image.open(r"image\l1.jpg")
img=img.resize((152,48))
img=ImageTk.PhotoImage(img)
b.config(image=img,cursor="hand2",command=login)
b.image=img
b.place(x=550,y=640)
t2.config(show="*")
#--------------------exit Button------------------
u1=Label(t)
b=Button(t,image=img)
img=Image.open(r"image\bc.png")
img=img.resize((154,47))
img=ImageTk.PhotoImage(img)
b.config(image=img,cursor="hand2",command=t.destroy)
b.image=img
b.place(x=850,y=640)
def mouseClick():
rog=Toplevel()
rog.title("Change password")
rog.geometry("500x300+530+280")
rog.iconbitmap("aa.ico")
rog.resizable(0,0)
rog.configure(bg='powder blue')
label=Label(rog,text="New
password",font=("cursive",30,'bold'),background='powder
blue',foreground='red')
label.place(x=105,y=15)
user=Label(rog,text='*User ID :',background='powder
blue',foreground='black',font=("cursive",12,'bold'))
user.place(x=40,y=95)
user.place(x=40, y=170)
e1.place(x=190, y=95,width=250,height=30)
e2.place(x=190, y=170,width=250,height=30)
def chan_pas():
a=e1.get()
b=e2.get()
conn=c.connect(host="localhost",user="root",password="",port="3306",
database="library_db")
cursor=conn.cursor()
#conn.commit()
data=cursor.fetchone()
if data!=None:
cursor=conn.cursor()
conn.commit()
rog.destroy()
else:
#--------------------Submit Button------------------
s=Label(rog)
b=Button(rog,image=img)
img6=Image.open(r"C:\Users\hp\Desktop\Submit.png")
img6=img6.resize((150,40))
img6=ImageTk.PhotoImage(img6)
b.config(image=img6,cursor="hand2",command=chan_pas)
b.image=img6
b.place(x=170,y=240)
rog.mainloop()
#--------------------Change Password Button------------------
o1=Label(t)
b=Button(t,image=img)
img=Image.open(r"E:\forgotpass.png")
img=img.resize((380,45))
img=ImageTk.PhotoImage(img)
b.config(image=img,cursor="hand2",command=mouseClick)
b.image=img
b.place(x=600,y=730)
lg()
MAIN PAGE:-
#con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase=library_db)
#cur = con.cursor()
def main():
root = Toplevel()
root.title("Library Managment")
root.minsize(width=400,height=400)
root.geometry("1600x800+0+0")
l=Label(root)
img=Image.open(r"E:\LIB.jpg")
img=img.resize((1600,700))
img=ImageTk.PhotoImage(img)
l.config(image=img)
l.image=img
l.place(x=0,y=105)
ll=Label(root)
img2=Image.open(r"C:\Users\hp\Desktop\logo6.png")
img2=img2.resize((200,100))
img2=ImageTk.PhotoImage(img2)
ll.config(image=img2)
ll.image=img2
ll.place(x=5,y=10,width=200,height=100)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.2,rely=0.2,relwidth=0.6,relheight=0.1
6)
headingLabel = Label(headingFrame1, text="Welcome to \n AI
Library Managment System",justify=CENTER, bg='black',
fg='white', font=('Courier',20))
headingLabel.config(anchor=CENTER)
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
def clock():
h=str(time.strftime("%H"))
m=str(time.strftime("%M"))
s=str(time.strftime("%S"))
dd=str(time.strftime("%d"))
mm=int(time.strftime("%m"))
yy=int(time.strftime("%y"))
lbldate.config(text=dd)
lblmonth.config(text=str(mm))
lblyear.config(text=str(yy))
lblhr=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblhr.place(x=1260,y=120,width=60,height=40)
lbldate=Label(root,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")
lbldate.place(x=1260,y=170,width=60,height=40)
lblmin=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblmin.place(x=1330,y=120,width=60,height=40)
lblmonth=Label(root,text="Month",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblmonth.place(x=1330,y=170,width=60,height=40)
lblsec=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblsec.place(x=1400,y=120,width=60,height=40)
lblyear=Label(root,text="Year",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblyear.place(x=1400,y=170,width=60,height=40)
lblnoon=Label(root,text="AM",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblnoon.place(x=1470,y=120,width=60,height=40)
lblcurrent=Label(root,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblcurrent.place(x=1470,y=170,width=60,height=40)
clock()
root.mainloop()
ADD BOOK PAGE:-
def bookRegister():
bid = bookInfo1.get()
title = bookInfo2.get()
author = bookInfo3.get()
status = bookInfo4.get()
status = status.lower()
root.destroy()
def addBook():
global
bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookT
able,root
root = Toplevel()
root.title("Library")
#root.minsize(width=400,height=400)
root.geometry("600x500+480+290")
con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase="library_db")
cur = con.cursor()
Canvas1 = Canvas(root)
Canvas1.config(bg="DarkOrange1")
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="Add 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.4,relwidth=0.8,relheight=0.4)
# Book ID
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62,
relheight=0.08)
# Title
lb2 = Label(labelFrame,text="Title : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.35, relheight=0.08)
bookInfo2 = Entry(labelFrame)
bookInfo2.place(relx=0.3,rely=0.35, relwidth=0.62,
relheight=0.08)
# Book Author
lb3 = Label(labelFrame,text="Author : ", bg='black', fg='white')
lb3.place(relx=0.05,rely=0.50, relheight=0.08)
bookInfo3 = Entry(labelFrame)
bookInfo3.place(relx=0.3,rely=0.50, relwidth=0.62,
relheight=0.08)
# Book Status
lb4 = Label(labelFrame,text="Status(Avail/issued) : ",
bg='black', fg='white')
lb4.place(relx=0.05,rely=0.65, relheight=0.08)
bookInfo4 = Entry(labelFrame)
bookInfo4.place(relx=0.3,rely=0.65, relwidth=0.62,
relheight=0.08)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=bookRegister)
SubmitBtn.place(relx=0.28,rely=0.9,
relwidth=0.18,relheight=0.08)
root.mainloop()
#addBook()
DELETE BOOK:-
con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase="library_db")
cur = con.cursor()
def deletebook():
bid = bookInfo1.get()
bookInfo1.delete(0, END)
root.destroy()
def deleteBook():
global
bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookT
able,root
root = Toplevel()
root.title("Library")
#root.minsize(width=400,height=400)
root.geometry("600x500+480+290")
Canvas1 = Canvas(root)
Canvas1.config(bg="DarkOrange1")
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)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
# Book ID to Delete
lb2 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb2.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="SUBMIT",bg='#d1ccc0',
fg='black',command=deletebook)
SubmitBtn.place(relx=0.28,rely=0.9,
relwidth=0.18,relheight=0.08)
con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase="library_db")
cur = con.cursor()
def viewBook():
root = Toplevel()
root.title("Library")
#root.minsize(width=400,height=400)
root.geometry("600x500+480+290")
Canvas1 = Canvas(root)
Canvas1.config(bg="DarkOrange1")
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)
Label(labelFrame, text="%-10s%-40s%-30s%-
20s"%('BID','Title','Author','Status'),bg='black',fg='white').place(rel
x=0.07,rely=0.1)
Label(labelFrame, text="---------------------------------------------------
-------------------------
",bg='black',fg='white').place(relx=0.05,rely=0.2)
getBooks = "select * from books"
cur.execute(getBooks)
for i in cur:
Label(labelFrame, text="%-10s%-40s%-30s%-
20s"%(i[0],i[1],i[2],i[3]),bg='black',fg='white').place(relx=0.07,rely=y
)
y += 0.1
con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase="library_db")
cur = con.cursor()
#List To store all Book IDs
allBid = []
def issue():
global
issueBtn,labelFrame,lb1,inf1,inf2,quitBtn,root,Canvas1,status
bid = inf1.get()
issueto = inf2.get()
issueBtn.destroy()
labelFrame.destroy()
lb1.destroy()
inf1.destroy()
inf2.destroy()
if check == 'avail':
status = True
else:
status = False
else:
messagebox.showinfo("Error","Book ID not
present",parent=root)
except:
messagebox.showinfo("Error","Can't fetch Book
IDs",parentroot)
allBid.clear()
def issueBook():
global
issueBtn,labelFrame,lb1,inf1,inf2,quitBtn,root,Canvas1,status
root = Tk()
root.title("Library")
#root.minsize(width=400,height=400)
root.geometry("600x500+480+290")
Canvas1 = Canvas(root)
Canvas1.config(bg="DarkOrange1")
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)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
# Book ID
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.2)
inf1 = Entry(labelFrame)
inf1.place(relx=0.3,rely=0.2, relwidth=0.62)
root.mainloop()
RETURN BOOK:-
con =
c.connect(host="localhost",user="root",password="",port="3306",d
atabase="library_db")
cur = con.cursor()
def returnn():
global
SubmitBtn,labelFrame,lb1,bookInfo1,quitBtn,root,Canvas1,status
bid = bookInfo1.get()
if bid in allBid:
checkAvail = "select status from books where bid =
'"+bid+"'"
cur.execute(checkAvail)
for i in cur:
check = i[0]
if check == 'issued':
status = True
else:
status = False
else:
messagebox.showinfo("Error","Book ID not
present",parent=root)
except:
messagebox.showinfo("Error","Can't fetch Book
IDs",parent=root)
#print(bid in allBid)
#print(status)
updateStatus = "update books set status = 'avail' where bid =
'"+bid+"'"
try:
if bid in allBid and status == True:
cur.execute(issueSql)
con.commit()
cur.execute(updateStatus)
con.commit()
messagebox.showinfo('Success',"Book Returned
Successfully",parent=root)
else:
allBid.clear()
messagebox.showinfo('Message',"Please check the book
ID",parent=root)
root.destroy()
return
except:
messagebox.showinfo("Search Error","The value entered is
wrong, Try again",parent=root)
allBid.clear()
root.destroy()
def returnBook():
global
bookInfo1,SubmitBtn,quitBtn,Canvas1,con,cur,root,labelFrame,
lb1
root = Tk()
root.title("Library")
#root.minsize(width=400,height=400)
root.geometry("600x500+480+290")
Canvas1 = Canvas(root)
Canvas1.config(bg="DarkOrange1")
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)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
# 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)
root.mainloop()
CONCLUSION
1. https://www.python.org/
2.https://www.w3schools.com/python/python_intro.a
sp
3.https://www.geeksforgeeks.org/python-
programming-language/