Index
Sr No. Topic Page No.
1 Project Objective 5
2 About Python 6
3 About SQL 7
4 System Development Life Cycle 8
5 About Project 9
6 Requirements 10
7 Data Structures 11
8 Input 13
9 Source Code 14
10 Output 33
12 Bibliography 45
Page 4
Project Objective
The main objective of this work is to reduce the difficulties
that are found in the present system. The present system
requires a lot of paper works, manual works, etc. The
accuracy is less in the present system. The details must
have to be stored manually in the present system. In the
present system, the details of a particular book are stored
in different registers by different persons; this often leads
to data isolation and inconsistency.
Some important ideas are:
I. To search records of a book efficiently.
II. Processing a large amount of data effectively and
efficiently.
III. To provide better service.
IV. It keeps database of publishing details, price and
customer record.
V. It helps to keep the entire information of the book
shop in a systematic way so that it becomes easier to
know about the books.
Page 5
About Python
Python is a computer programming language often
used to build websites and software, automate tasks,
and conduct data analysis. Python is a general-
purpose language, meaning it can be used to create
a variety of different programs and isn’t specialized
for any specific problems. This versatility, along with
its beginner-friendliness, has made it one of the
most-used programming languages today.
Page 6
About SQL
Structured Query Language (SQL) is a domain-
specific language used in programming and
designed for managing data held in a relational
database management system (RDBMS). It is used
for streaming processing in a relational data stream
management (RDBMS). It is particularly useful in
handling structured data, i.e., data incorporating
relations among entities and variables.
Page 7
System Development Life Cycle
(SDLC)
System Development Life Cycle (SDLC) is a conceptual
model which includes policies and procedures for
developing or altering systems throughtout their life cycles.
SDLC is used by analysts to develop an information
system.
Page 8
About Project
Our project is on Library Book Management System
which deals with almost all the information of Library.
It keeps the database of all book records and
customer rercords. It also keeps the author, book
title, and seller records.
A large record should be maintained in a proper
manner for running a library. It reduces the paper
works, time needed for doing various tasks etc. Our
project upholds the accuracy of data.
Page 9
Requirements
Hardware requirements:
• Pc / Laptop (Windows 8 and above or MacOS)
Software requirements:
• Mysql
• Python
• Operating System (OS)
• MS Word
Page 10
Data Structure of Table
Books:
Table Name: Books
Description: Used to maintian Book records.
Terms Used Data Type Constraint
bid Integer Primary Key, Not Null
title Varchar(100) Not Null
author Varchar(100) Not Null
status Varchar(30) Not Null
seller Varchar(50) Not Null
Book Issued:
Table Name: books_issued
Description: Used to maintain book issued records.
Terms Used Data Type Constraint
bid Integer Primary Key, Not Null
issuedto Varchar(50) Not Null
Page 11
Book History:
Table Name: books_hist
Description: Used to maintain Book issued history records.
Terms Used Data Type Constraint
bid Integer Not Null
issuedto Varchar(50) Not Null
date_of_issue Varchar(50) Not Null
Page 12
Input in SQL
Creating Database
Creating Table “books”
Creating Table “books_issued”
Creating Table “book_history”
Page 13
Source Code
1) [Link]
from tkinter import *
from PIL import ImageTk, Image
import pymysql
from tkinter import messagebox
from AddBook import *
from DeleteBook import *
from ViewBooks import *
from IssueBook import *
from ReturnBook import *
from BookHistory import *
from UpdateBook import *
from SellerBooks import *
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
same = True
n = 0.25
background_image = [Link]("[Link]")
[imageSizeWidth, imageSizeHeight] = background_image.size
newImageSizeWidth = int(imageSizeWidth * n)
if same:
newImageSizeHeight = int(imageSizeHeight * n)
else:
newImageSizeHeight = int(imageSizeHeight / n)
background_image = background_image.resize((newImageSizeWidth, newImageSizeHeight),
[Link])
img = [Link](background_image)
Canvas1 = Canvas(root)
Canvas1.create_image(300, 340, image=img)
[Link](bg="white", width=newImageSizeWidth, height=newImageSizeHeight)
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.2, rely=0.1, relwidth=0.6, relheight=0.16)
Page 14
headingLabel = Label(headingFrame1, text=" Welcome to \n GFGS Library", bg='black',
fg='white', font=('Courier', 20))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
btn1 = Button(root, text="Add Book Details", bg='black', fg='white', font=('Courier',
13), command=addBook)
[Link](relx=0.1, rely=0.4, relwidth=0.4, relheight=0.11)
btn2 = Button(root, text="Delete Book", bg='black', fg='white', font=('Courier', 13),
command=delete)
[Link](relx=0.5, rely=0.4, relwidth=0.4, relheight=0.11)
btn3 = Button(root, text="View Book List", bg='black', fg='white', font=('Courier',
13), command=View)
[Link](relx=0.1, rely=0.51, relwidth=0.4, relheight=0.11)
btn4 = Button(root, text="Issue Book to Student", bg='black', fg='white',
font=('Courier', 13), command=issueBook)
[Link](relx=0.5, rely=0.51, relwidth=0.4, relheight=0.11)
btn5 = Button(root, text="Book Issued", bg='black', fg='white', font=('Courier', 13),
command=history)
[Link](relx=0.1, rely=0.62, relwidth=0.4, relheight=0.11)
btn6 = Button(root, text="Return Book", bg='black', fg='white', font=('Courier', 13),
command=returnBook)
[Link](relx=0.5, rely=0.62, relwidth=0.4, relheight=0.11)
btn7 = Button(root, text="Update Book", bg='black', fg='white', font=('Courier', 13),
command=updateBook)
[Link](relx=0.1, rely=0.73, relwidth=0.4, relheight=0.11)
btn8 = Button(root, text="Update Book", bg='black', fg='white', font=('Courier', 13),
command=seller)
[Link](relx=0.5, rely=0.73, relwidth=0.4, relheight=0.11)
[Link]()
2) [Link]
from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
import pymysql
def bookRegister():
bid = [Link]()
title = [Link]()
author = [Link]()
status = [Link]()
status = [Link]()
seller = [Link]()
Page 15
insertBooks = "insert into " + bookTable + " values('" + bid + "','" +
title + "','" + author + "','" + status + "','" + seller + "')"
try:
[Link](insertBooks)
[Link]()
[Link]('Success', "Book added successfully")
except:
[Link]("Error", "Can't add data into Database")
[Link]()
def addBook():
global bookInfo1, bookInfo2, bookInfo3, bookInfo4, bookInfo5, Canvas1,
con, cur, bookTable, root
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
bookTable = "books"
Canvas1 = Canvas(root)
[Link](bg="#ff6e40")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](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))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='black')
[Link](relx=0.1, rely=0.4, relwidth=0.8, relheight=0.4)
lb1 = Label(labelFrame, text="Book ID : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.2, relheight=0.08)
bookInfo1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.2, relwidth=0.62, relheight=0.08)
lb2 = Label(labelFrame, text="Title : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.35, relheight=0.08)
bookInfo2 = Entry(labelFrame)
[Link](relx=0.3, rely=0.35, relwidth=0.62, relheight=0.08)
Page 16
lb3 = Label(labelFrame, text="Author : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.50, relheight=0.08)
bookInfo3 = Entry(labelFrame)
[Link](relx=0.3, rely=0.50, relwidth=0.62, relheight=0.08)
lb4 = Label(labelFrame, text="Status(Avail/Issued) : ", bg='black',
fg='white')
[Link](relx=0.05, rely=0.65, relheight=0.08)
bookInfo4 = Entry(labelFrame)
[Link](relx=0.3, rely=0.65, relwidth=0.62, relheight=0.08)
lb5 = Label(labelFrame, text="Seller : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.8, relheight=0.08)
bookInfo5 = Entry(labelFrame)
[Link](relx=0.3, rely=0.8, relwidth=0.62, relheight=0.08)
SubmitBtn = Button(root, text="SUBMIT", bg='#d1ccc0', fg='black',
command=bookRegister)
[Link](relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
3) [Link]
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
issueTable = "books_issued"
bookTable = "books"
def deleteBook():
bid = [Link]()
deleteSql = "delete from " + bookTable + " where bid = '" + bid + "'"
Page 17
deleteIssue = "delete from " + issueTable + " where bid = '" + bid + "'"
try:
[Link](deleteSql)
[Link]()
[Link](deleteIssue)
[Link]()
[Link]('Success', "Book Record Deleted Successfully")
except:
[Link]("Please check Book ID")
print(bid)
[Link](0, END)
[Link]()
def delete():
global bookInfo1, bookInfo2, bookInfo3, bookInfo4, Canvas1, con, cur,
bookTable, root
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#006B38")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Delete Book", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
lb2 = Label(labelFrame, text="Book ID : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.5)
bookInfo1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.5, relwidth=0.62)
SubmitBtn = Button(root, text="SUBMIT", bg='#d1ccc0', fg='black',
command=deleteBook)
[Link](relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
Page 18
4) [Link]
from tkinter import *
from tkinter import ttk
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
bookTable = "books"
def View():
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#12a4d9")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](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))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='#12a4d9')
[Link](relx=0.085, rely=0.3, relwidth=0.83, relheight=0.4)
yframeScroll = Scrollbar(labelFrame)
[Link](side=RIGHT, fill=Y)
style = [Link]()
[Link]("[Link]", foreground = "Grey")
my_tree = [Link](labelFrame, style="[Link]",
yscrollcommand=[Link])
my_tree['columns'] = ("[Link]", "Title", "Author", "Status", "Seller")
my_tree.column('#0', width=0, stretch=NO)
my_tree.column("[Link]", anchor=CENTER, width=50)
Page 19
my_tree.column("Title", anchor=W, width=160)
my_tree.column("Author", anchor=W, width=140)
my_tree.column("Status", anchor=W, width=45)
my_tree.column("Seller", anchor=W, width=80)
my_tree.heading("#0", text="", anchor=W)
my_tree.heading("[Link]", text="Book ID", anchor=W)
my_tree.heading("Title", text="Title", anchor=W)
my_tree.heading("Author", text="Author", anchor=W)
my_tree.heading("Status", text="Status", anchor=W)
my_tree.heading("Seller", text="Seller", anchor=W)
getBooks = "select * from " + bookTable
try:
x = []
[Link](getBooks)
[Link]()
count = 0
for i in cur:
my_tree.insert(parent='', index='end', iid=count, text="",
values=(i[0], i[1], i[2], i[3], i[4]))
count += 1
except:
[Link]("Failed to fetch files from database")
my_tree.pack(pady=0)
[Link](command=my_tree.yview())
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.4, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
5) [Link]
from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con =
[Link](host="localhost",user="root",password=mypass,database=mydatab
ase)
cur = [Link]()
Page 20
issueTable = "books_issued"
bookTable = "books"
bookHistory = "book_history"
allBid = []
def issue():
global issueBtn, labelFrame, lb1, inf1, inf2, inf3, quitBtn, root,
Canvas1, status
bid = [Link]()
issueto = [Link]()
date_of_issue = [Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
extractBid = "select bid from " + bookTable
try:
[Link](extractBid)
[Link]()
for i in cur:
[Link](i[0])
if bid in allBid:
checkAvail = "select status from " + bookTable + " where bid = '"
+ bid + "'"
[Link](checkAvail)
[Link]()
for i in cur:
check = i[0]
if check == 'Avail':
status = True
else:
status = False
else:
[Link]("Error", "Book ID not present")
except:
[Link]("Error", "Can't fetch Book IDs")
issueSql = "insert into " + issueTable + " values ('" + bid + "','" +
issueto + "')"
show = "select * from " + issueTable
issueHistory = "insert into " + bookHistory + " values('" + bid + "','" +
issueto + "','" + date_of_issue + "')"
updateStatus = "update " + bookTable + " set status = 'issued' where bid
= '" + bid + "'"
try:
Page 21
if bid in allBid and status == True:
[Link](issueSql)
[Link]()
[Link](updateStatus)
[Link]()
[Link](issueHistory)
[Link]()
[Link]('Success', "Book Issued Successfully")
[Link]()
else:
[Link]()
[Link]('Message', "Book Already Issued")
[Link]()
return
except:
[Link]("Search Error", "The value entered is wrong, Try
again")
print(bid)
print(issueto)
[Link]()
def issueBook():
global issueBtn, labelFrame, lb1, inf1, inf2, inf3, quitBtn, root,
Canvas1, status
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#D6ED17")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Issue Book", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
lb1 = Label(labelFrame, text="Book ID : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.2)
inf1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.2, relwidth=0.62)
lb2 = Label(labelFrame, text="Issued To : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.4)
inf2 = Entry(labelFrame)
Page 22
[Link](relx=0.3, rely=0.4, relwidth=0.62)
lb3 = Label(labelFrame, text="Date of Issue : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.6)
inf3 = Entry(labelFrame)
[Link](relx=0.3, rely=0.6, relwidth=0.62)
issueBtn = Button(root, text="Issue", bg='#d1ccc0', fg='black',
command=issue)
[Link](relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
quitBtn = Button(root, text="Quit", bg='#aaa69d', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
6) [Link]
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con =
[Link](host="localhost",user="root",password=mypass,database=mydatabase)
cur = [Link]()
issueTable = "books_issued"
bookTable = "books"
bookHistory = "book_history"
allBid = []
def returnn():
global SubmitBtn, labelFrame, lb1, bookInfo1, quitBtn, root, Canvas1, status,
date_of_return
bid = [Link]()
extractBid = "select bid from " + issueTable
try:
[Link](extractBid)
[Link]()
for i in cur:
[Link](i[0])
if bid in allBid:
checkAvail = "select status from " + bookTable + " where bid = '" + bid +
"'"
Page 23
[Link](checkAvail)
[Link]()
for i in cur:
check = i[0]
if check == 'issued':
status = True
else:
status = False
else:
[Link]("Error", "Book ID not present")
except:
[Link]("Error", "Can't fetch Book IDs")
issueSql = "delete from " + issueTable + " where bid = '" + bid + "'"
print(bid in allBid)
print(status)
updateStatus = "update " + bookTable + " set status = 'Avail' where bid = '" + bid
+ "'"
try:
if bid in allBid and status == True:
[Link](issueSql)
[Link]()
[Link](updateStatus)
[Link]()
[Link]('Success', "Book Returned Successfully")
else:
[Link]()
[Link]('Message', "Please check the book ID")
[Link]()
return
except:
[Link]("Search Error", "The value entered is wrong, Try again")
[Link]()
[Link]()
def returnBook():
global bookInfo1, SubmitBtn, quitBtn, Canvas1, con, cur, root, labelFrame, lb1
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#006B38")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Return Book", bg='black', fg='white',
font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
Page 24
lb1 = Label(labelFrame, text="Book ID : ", bg='black', fg='white')
[Link](relx=0.05, rely=0.3)
bookInfo1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.3, relwidth=0.62)
SubmitBtn = Button(root, text="Return", bg='#d1ccc0', fg='black', command=returnn)
[Link](relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
7) [Link]
from tkinter import *
from tkinter import ttk
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
historyTable = "book_history"
def history():
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#d9124a")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Books Issued", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='#d9124a')
[Link](relx=0.2, rely=0.3, relwidth=0.6, relheight=0.45)
Page 25
yframeScroll = Scrollbar(labelFrame)
[Link](side=RIGHT, fill=Y)
style = [Link]()
[Link]("[Link]", foreground="Grey")
my_tree = [Link](labelFrame, style="[Link]",
yscrollcommand=[Link])
my_tree['columns'] = ("[Link]", "Issued To", "Date of Issue",)
my_tree.column('#0', width=0, stretch=NO)
my_tree.column("[Link]", anchor=CENTER, width=60)
my_tree.column("Issued To", anchor=W, width=180)
my_tree.column("Date of Issue", anchor=W, width=100)
my_tree.heading("#0", text="", anchor=W)
my_tree.heading("[Link]", text="Book ID", anchor=W)
my_tree.heading("Issued To", text="Issued To", anchor=W)
my_tree.heading("Date of Issue", text="Date of Issue", anchor=W)
getBooks = "select * from " + historyTable
try:
x=[]
[Link](getBooks)
[Link]()
count=0
for i in cur:
my_tree.insert(parent='', index='end', iid=count, text="",
values=(i[0], i[1], i[2]))
count += 1
except:
[Link]("Failed to fetch files from database")
my_tree.pack(pady=0)
[Link](command=my_tree.yview())
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.4, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
8) [Link]
from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
import pymysql
Page 26
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
updateTable = "books"
def updateTitle():
global root1, canvas2, lableFrame, lb1, lb2, bookInfo1, bookInfo2,
SubmitBtn1, quitBtn1
root1 = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas2 = Canvas(root1)
[Link](bg="#5EDA9E")
[Link](expand=True, fill=BOTH)
headingFrame2 = Frame(root1, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel2 = Label(headingFrame2, text="Update Title", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root1, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
lb1 = Label(labelFrame, text="Book ID: ", bg='black', fg='white')
[Link](relx=0.05, rely=0.3, relheight=0.08)
bookInfo1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.3, relwidth=0.62)
lb2 = Label(labelFrame, text="New Title: ", bg='black', fg='white')
[Link](relx=0.05, rely=0.5, relheight=0.08)
bookInfo2 = Entry(labelFrame)
[Link](relx=0.3, rely=0.5, relwidth=0.62)
SubmitBtn1 = Button(root1, text="Submit", bg='#d1ccc0', fg='black',
command=updateT)
[Link](relx=0.28, rely=0.85, relwidth=0.18, relheight=0.08)
quitBtn1 = Button(root1, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.85, relwidth=0.18, relheight=0.08)
[Link]()
def updateT():
bid = [Link]()
Page 27
title = [Link]()
updateti = "update " + updateTable + " set title = '" + title + "' where
bid = '" + bid + "'"
try:
[Link](updateti)
[Link]()
[Link]('Success', "Title updated successfully")
except:
[Link]("Error", "Can't update data into Database")
[Link]()
def updateAuthor():
global root2, canvas3, lableFrame2, lb3, lb4, bookInfo3, bookInfo4,
SubmitBtn2, quitBtn2
root2 = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas3 = Canvas(root2)
[Link](bg="#4CBB17")
[Link](expand=True, fill=BOTH)
headingFrame3 = Frame(root2, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel3 = Label(headingFrame3, text="Update Author", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame2 = Frame(root2, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
lb3 = Label(labelFrame2, text="Book ID: ", bg='black', fg='white')
[Link](relx=0.05, rely=0.3, relheight=0.08)
bookInfo3 = Entry(labelFrame2)
[Link](relx=0.3, rely=0.3, relwidth=0.62)
lb4 = Label(labelFrame2, text="New Author: ", bg='black', fg='white')
[Link](relx=0.05, rely=0.5, relheight=0.08)
bookInfo4 = Entry(labelFrame2)
[Link](relx=0.3, rely=0.5, relwidth=0.62)
SubmitBtn2 = Button(root2, text="Submit", bg='#d1ccc0', fg='black',
command=updateA)
[Link](relx=0.28, rely=0.85, relwidth=0.18, relheight=0.08)
quitBtn2 = Button(root2, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.53, rely=0.85, relwidth=0.18, relheight=0.08)
Page 28
[Link]()
def updateA():
bid1 = [Link]()
author = [Link]()
updateAu = "update " + updateTable + " set author = '" + author + "'
where bid = '" + bid1 + "'"
try:
[Link](updateAu)
[Link]()
[Link]('Success', "Author updated successfully")
except:
[Link]("Error", "Can't update data into Database")
[Link]()
def updateBook():
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#754C78")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Update Book", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
btn1 = Button(root, text="Update Book Title", bg='black', fg='white',
font=('Courier', 13), command=updateTitle)
[Link](relx=0.225, rely=0.4, relwidth=0.55, relheight=0.15)
btn2 = Button(root, text="Update Book Author", bg='black', fg='white',
font=('Courier', 13), command=updateAuthor)
[Link](relx=0.225, rely=0.55, relwidth=0.55, relheight=0.15)
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.4, rely=0.85, relwidth=0.2, relheight=0.08)
[Link]()
Page 29
9) [Link]
from tkinter import *
from tkinter import ttk
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
mypass = "G@UR@V_2005"
mydatabase = "db"
con = [Link](host="localhost", user="root", password=mypass,
database=mydatabase)
cur = [Link]()
bookTable = "books"
def pickSeller():
root1 = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas2 = Canvas(root1)
[Link](bg="#006B38")
[Link](expand=True, fill=BOTH)
headingFrame2 = Frame(root1, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel1 = Label(headingFrame2, text="Books from seller", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame1 = Frame(root1, bg='black')
[Link](relx=0.085, rely=0.3, relwidth=0.83, relheight=0.4)
name = [Link]()
yframeScroll = Scrollbar(labelFrame1)
[Link](side=RIGHT, fill=Y)
style = [Link]()
[Link]("[Link]", foreground="Grey")
my_tree = [Link](labelFrame1, style="[Link]",
yscrollcommand=[Link])
my_tree['columns'] = ("[Link]", "Title", "Author", "Status", "Seller")
my_tree.column('#0', width=0, stretch=NO)
my_tree.column("[Link]", anchor=CENTER, width=50)
my_tree.column("Title", anchor=W, width=160)
my_tree.column("Author", anchor=W, width=140)
my_tree.column("Status", anchor=W, width=45)
my_tree.column("Seller", anchor=W, width=80)
my_tree.heading("#0", text="", anchor=W)
my_tree.heading("[Link]", text="Book ID", anchor=W)
my_tree.heading("Title", text="Title", anchor=W)
Page 30
my_tree.heading("Author", text="Author", anchor=W)
my_tree.heading("Status", text="Status", anchor=W)
my_tree.heading("Seller", text="Seller", anchor=W)
getBook = "select * from " + bookTable + " where seller = '" + name + "'"
try:
# x = []
[Link](getBook)
[Link]()
count = 0
for i in cur:
my_tree.insert(parent='', index='end', iid=count, text="",
values=(i[0], i[1], i[2], i[3], i[4]))
count += 1
except:
[Link]("Failed to fetch files from database")
my_tree.pack(pady=0)
[Link](command=my_tree.yview())
quitBtn1 = Button(root1, text="Quit", bg='#f7f1e3', fg='black',
command=[Link])
[Link](relx=0.4, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
def seller():
global bookInfo1, SubmitBtn, quitBtn, Canvas1, con, cur, root, labelFrame
root = Tk()
[Link]("Library")
[Link](width=400, height=400)
[Link]("600x500")
Canvas1 = Canvas(root)
[Link](bg="#0086b3")
[Link](expand=True, fill=BOTH)
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
[Link](relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
headingLabel = Label(headingFrame1, text="Books from Seller", bg='black',
fg='white', font=('Courier', 15))
[Link](relx=0, rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root, bg='black')
[Link](relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
lb1 = Label(labelFrame, text="Seller Name: ", bg='black', fg='white')
[Link](relx=0.05, rely=0.3)
bookInfo1 = Entry(labelFrame)
[Link](relx=0.3, rely=0.3, relwidth=0.62)
SubmitBtn = Button(root, text="Submit", bg='#d1ccc0', fg='black',
command=pickSeller)
[Link](relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
quitBtn = Button(root, text="Quit", bg='#f7f1e3', fg='black',
Page 31
command=[Link])
[Link](relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
[Link]()
Page 32
Output
Page 33
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
Page 41
Page 42
Page 43
Page 44
Bibliography
• CS Textbook Class 12: Preeti Arora
• [Link]
Page 45
Page 46