Slms
Slms
V GROUP OF SCHOOLS
PALLIKARANAI
NAME: M. Jayanieca
CLASS: XII-D
ROLL NO:
D.A.V. SCHOOL – PALLIKARANAI
DEPARTMENT OF COMPUTER SCIENCE
CERTIFICATE
Certified that this is a bonafide report of
School Library Management System work done by
M.Jayanieca during the year 2024 – 2025.
Teacher-In-Charge
Submitted for the Practical Examination in Computer Science (083) at DAV School
Internal Examiner
The Library Management System (LMS) is designed to streamline and automate key
functions of library operations, allowing efficient management of books, members,
and borrowing activities. Developed using Python's Tkinter library for the graphical
user interface (GUI) and MySQL for the backend database, this application combines
an intuitive, user-friendly design with a robust database to handle and track library
resources. The LMS includes core functionalities such as adding new books to the
database, searching for books based on various criteria (title, author, genre), issuing
and returning books with due date management, and tracking for overdue returns.
A standout feature of this system is the integration with MySQL, enabling secure,
structured storage and retrieval of data. This ensures that book records, member
details, and transaction histories are preserved accurately, enhancing the reliability
of the system. The Tkinter GUI simplifies the interaction process, allowing librarians
to interact with the LMS via a menu-driven interface where each function is clearly
labeled. Each major operation, from adding a book to retrieving the list of issued
books, is presented with user prompts, ensuring ease of use even for those with
limited technical knowledge.
1|Page
The LMS also facilitates effective management of borrowing rules by implementing
automated due date calculations and fine assessments. When a book is issued, the
system sets a two-week borrowing period, automatically calculating and updating
the due date in the system. Additionally, the fine calculation feature charges a
nominal fee for each day a book is overdue, providing a structured way to handle late
returns. Beyond this, the system includes a student detail feature that retrieves and
displays information about a particular student, enabling staff to quickly verify
member data. Together, these features create a robust library environment where
daily activities are managed efficiently, promoting better resource management and
a smoother experience for both librarians and members.
2|Page
Python and its Applications
1. Overview of Python
3|Page
2. Key Features of Python
Python’s popularity is largely due to its unique and powerful features, which make it
suitable for both beginners and experienced programmers. Below are some of its key
features:
• Interpreted Language
Python is an interpreted language, meaning that code is executed line by line, which
allows for immediate error detection and debugging. Unlike compiled languages,
such as C or Java, Python does not require a separate compilation step, making it
highly flexible and ideal for rapid development and testing.
• Cross-Platform Compatibility
4|Page
• Extensive Standard Library
Python comes with a rich standard library, which provides modules and functions for
handling a wide variety of tasks, such as file handling, system interfaces, and even
internet protocols. The extensive library helps programmers accomplish tasks
without needing to write code from scratch. Additionally, Python has a vast
ecosystem of third-party libraries available via the Python Package Index (PyPI),
allowing developers to expand Python’s functionality even further.
• Dynamic Typing
Python is dynamically typed, meaning that variable types are determined at runtime.
This reduces the amount of code needed to declare and initialize variables and
makes it easier to prototype and test code. However, dynamic typing also requires
careful management to avoid runtime errors, which Python helps mitigate with clear
error messages.
5|Page
3) Applications of Python
Python’s versatility and robust ecosystem make it suitable for a wide range of
applications, from web development to machine learning. Some of the primary
applications of Python are discussed below
• Web Development
Python has become a popular choice for web development due to frameworks like
Django and Flask. Django is a high-level web framework that promotes rapid
development and clean, pragmatic design. Flask, a micro-framework, offers more
flexibility and is preferred for smaller applications and projects where developers
want control over components. Both frameworks enable developers to build secure,
scalable, and maintainable web applications efficiently.
• Game Development
While Python is not as widely used in game development as other languages like C++
or Java, it has frameworks such as Pygame that simplify game development for
beginners. Pygame is a set of Python modules designed for creating 2D games, and
it’s commonly used in educational settings to introduce programming and game
design concepts.
Python can also be used to create desktop graphical user interface (GUI) applications
with libraries like Tkinter, PyQt, and Kivy. Tkinter, which comes pre-installed with
Python, is a simple tool for creating basic GUI applications
6|Page
MySQL and Its Applications with Python Interface
1. Objective of MySQL
MySQL is optimized for performance and security, with mechanisms for indexing,
transaction management, and user access control. These features allow MySQL to
serve a diverse range of applications, from lightweight content management systems
(CMS) to high-performance enterprise applications. Additionally, MySQL is designed
to be cross-platform, enabling deployment on Windows, macOS, Linux, and Unix
systems. Its scalability and reliability make it one of the most popular choices for
databases worldwide.
7|Page
2. Applications of MySQL with Python Interface
Python, with its flexible and robust capabilities, is often used in combination with
MySQL to build, manage, and interact with databases. Through Python’s libraries
such as MySQL Connector and SQLAlchemy, developers can perform database
operations in a structured and programmatic manner, making Python and MySQL a
powerful pair for data-driven applications. Below are some key applications of
MySQL with Python:
One of the most common applications of MySQL with Python is in web development,
where MySQL is used as the primary database for storing user data, session data,
and content. Python web frameworks such as Django and Flask integrate well with
MySQL to manage database connections and handle requests.
In machine learning (ML) and artificial intelligence (AI) projects, MySQL is often used
as a data source to store training and testing data. With Python’s machine learning
libraries such as Scikit-Learn, TensorFlow, and Keras, developers can pull data from
MySQL, process it, and feed it into ML models for training and prediction. Since
machine learning models require large volumes of data, MySQL’s ability to handle
structured and relational data is beneficial for organizing and retrieving datasets in an
efficient manner.
8|Page
Tkinter in Python
Tkinter is the standard GUI (Graphical User Interface) library for Python, providing a
powerful toolkit for creating user-friendly applications with visual elements. Its
primary objective is to enable Python developers to build desktop applications with
windows, buttons, text boxes, and other interactive components without needing
extensive knowledge of advanced GUI frameworks. By abstracting complex GUI
programming details, Tkinter offers a simplified way to design interfaces that handle
user input and display information effectively.
9|Page
Hardware and Software Requirements
Hardware Requirements
Software Requirement
10 | P a g e
Objective
1. Efficient Library Resource Management: The code aims to create a
comprehensive digital system for managing library resources, including books and
member records. It automates book cataloging, issuance, returns, and fine
calculation, significantly reducing manual workload
2. User-Friendly Interface: With the use of Python's Tkinter library, the code
provides an intuitive graphical user interface (GUI) that allows library staff to perform
tasks such as adding new books, searching for books, issuing books to students, and
processing book returns with minimal training
3. Real-Time Data Processing: The code integrates Python with MySQL to store and
retrieve data in real time. This integration ensures up-to-date records, allowing the
library staff to track books accurately and keep records of active and overdue issued
books.
4. Error Handling and Data Integrity: By including error handling in the MySQL
database connection and other critical operations, the code ensures robustness and
prevents data loss or corruption. Constraints, such as unique identifiers and
automated primary keys, maintain database integrity.
11 | P a g e
5. Automated Fine Calculation: The code automatically calculates fines based on
the number of overdue days for returned books. This feature streamlines the return
process and enforces timely book returns, enhancing accountability among users.
12 | P a g e
Functions
13 | P a g e
User defined functions:
1. addbookwindow()
This function creates a new window for adding a book to the library database. It
contains text fields for entering the book's title, author, and genre.When the "Add
Book" button is clicked, the book's details are inserted into the `books` table in the
database.It also performs error handling, ensuring that all fields are filled before
adding a book.
2. searchbookwindow()
This function creates a new window where users can search for books in the library
database by title, author, or genre. Users enter a search term in the provided field, and
the program queries the database for books matching the search term. Results are
displayed in a `Listbox`, and each entry shows the book's ID, title, author, and genre.
14 | P a g e
3. showbookwindow()
This function creates a window displaying a list of all books in the library. It uses a
`Treeview` widget to show book details (ID, Title, Author, and Genre) in a table
format. It fetches the data from the `books` table in the database and inserts the
records into the treeview.
4. issuebookwindow()
This function creates a new window to issue a book to a student. It prompts the user
for the `book_id` and `student_id`.When the "Issue Book" button is clicked, it
inserts a record into the `issued_books` table with the issue date and calculates a
due date (14 days from the issue date) A confirmation message with the due date is
displayed.
5. returnbookwindow()
This function creates a new window to return a book.It asks for the `issue_id` (which
links the book and the student)The return date is logged, and if the return is late, a fine
is calculated based on how many days late the book is returned.It updates the
`issued_books` table with the return date and any applicable fine.
15 | P a g e
6. howstudentwindow()
This function creates a window to show details of a student based on their name.The
user enters a student's name, and the program queries the `students` table for a
matching student record If the student is found, their details (ID, name, email, and
phone) are displayed in a message box.
7.showissuetablewindow()
This function creates a new window to display a table of all issued books.It uses a
`Treeview` widget to show details of each issued book, such as `Issue ID`, `Book
ID`, `Member ID`, `Issue Date`, `Due Date`, `Return Date`, and `Fine`. It
queries the `issued_books` table and displays all the records in the treeview.
16 | P a g e
Tkinter Functions and widgets:
1. Tk()
Creates the main Tkinter window. It's the starting point of the application.Every
Tkinter application needs to have one `Tk()` instance as the root window.
2. Toplevel()
Creates a new top-level window (a separate window on top of the main window).
Used when you want to open new windows for different functionalities (like adding
books, issuing books, etc.) while keeping the main window intact.
3. Label()
`Label` is a widget used to display text or an image. It doesn't allow user interaction;
it's used to provide information.`text` specifies the content to display, and `bg` sets
the background color of the label.`font` changes the text style.`pack()` and `grid()`
are geometry managers used to place the label within the window.
4. Entry()
`Entry` is a widget used to create text input fields where users can type data (e.g.,
book titles, student names). Users interact with it to input values.
17 | P a g e
5. Button()
`Button` is used to create clickable buttons in your GUIThe `text` argument defines
the text shown on the button The `command` argument links the button to a
function, so when the button is clicked, that function is executed.
6. Listbox()
Users can select one or more items from the list. In your code, it's used to display
search results for books, where each result is a string showing the book's ID, title,
author, and genre.
7.pack()
8.grid()
9.messagebox()
These dialog boxes are modal, meaning the user must acknowledge them before
interacting with the main window again.
18 | P a g e
Flowchart
19 | P a g e
20 | P a g e
Source code
21 | P a g e
import mysql.connector
try:
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="root",
database="library_management"
cursor = mydb.cursor()
exit()
WINDOW_SIZE = "500x500"
22 | P a g e
def addbookwindow():
add_window = Toplevel(root)
add_window.title("Add Book")
add_window.geometry(WINDOW_SIZE)
add_window.configure(bg=BACKGROUND_COLOR)
title_entry = Entry(add_window)
title_entry.grid(row=0, column=1)
author_entry = Entry(add_window)
author_entry.grid(row=1, column=1)
genre_entry = Entry(add_window)
genre_entry.grid(row=2, column=1)
def add_book():
try:
title = title_entry.get()
23 | P a g e
author = author_entry.get()
genre = genre_entry.get()
mydb.commit()
add_window.destroy()
else:
def searchbookwindow():
search_window = Toplevel(root)
search_window.title("Search Books")
search_window.geometry(WINDOW_SIZE)
search_window.configure(bg=BACKGROUND_COLOR)
24 | P a g e
Label(search_window, text="Search", bg=BACKGROUND_COLOR).grid(row=0,
column=0)
search_entry = Entry(search_window)
search_entry.grid(row=0, column=1)
def search_books():
try:
query = search_entry.get()
results = cursor.fetchall()
search_result_list.delete(0, END)
25 | P a g e
Button(search_window, text="Search", command=search_books).grid(row=2,
column=1)
def showbookwindow():
show_window = Toplevel(root)
show_window.title("List of Books")
show_window.geometry(WINDOW_SIZE)
show_window.configure(bg=BACKGROUND_COLOR)
tree.heading("ID", text="ID")
tree.heading("Title", text="Title")
tree.heading("Author", text="Author")
tree.heading("Genre", text="Genre")
26 | P a g e
try:
def issuebookwindow():
issue_window = Toplevel(root)
issue_window.title("Issue Book")
issue_window.geometry(WINDOW_SIZE)
issue_window.configure(bg=BACKGROUND_COLOR)
book_id_entry = Entry(issue_window)
book_id_entry.grid(row=0, column=1)
student_id_entry = Entry(issue_window)
27 | P a g e
student_id_entry.grid(row=1, column=1)
def issue_book():
try:
book_id = book_id_entry.get()
student_id = student_id_entry.get()
issue_date = datetime.now()
mydb.commit()
issue_window.destroy()
28 | P a g e
def returnbookwindow():
return_window = Toplevel(root)
return_window.title("Return Book")
return_window.geometry(WINDOW_SIZE)
return_window.configure(bg=BACKGROUND_COLOR)
issue_id_entry = Entry(return_window)
issue_id_entry.grid(row=0, column=1)
def return_book():
try:
issue_id = issue_id_entry.get()
return_date = datetime.now()
due_date = cursor.fetchone()[0]
29 | P a g e
cursor.execute("UPDATE issued_books SET fine = %s WHERE issue_id = %s",
(fine, issue_id))
else:
fine = 0
mydb.commit()
return_window.destroy()
def showstudentwindow():
student_window = Toplevel(root)
student_window.title("Show Student")
student_window.geometry(WINDOW_SIZE)
student_window.configure(bg=BACKGROUND_COLOR)
30 | P a g e
Label(student_window, text="Student Name",
bg=BACKGROUND_COLOR).grid(row=0, column=0)
student_name_entry = Entry(student_window)
student_name_entry.grid(row=0, column=1)
def show_student():
student_name = student_name_entry.get()
student = cursor.fetchone()
if student:
else:
def showissuetablewindow():
issue_window = Toplevel(root)
issue_window.title("Issued Books")
issue_window.geometry(WINDOW_SIZE)
31 | P a g e
issue_window.configure(bg=BACKGROUND_COLOR)
tree.heading(col, text=col)
try:
root = Tk()
root.geometry(WINDOW_SIZE)
root.configure(bg=BACKGROUND_COLOR)
32 | P a g e
Label(root, text="SCHOOL LIBRARY MANAGEMENT SYSTEM", font=("Arial", 32,
"bold"), bg=BACKGROUND_COLOR).pack(pady=10)
Label(root, text="1. Add Book\n2. Search Book\n3. Show Book List\n4. Issue
Book\n5. Return Book\n6. Show Student Details\n7. Show Issued Books",
menubar = Menu(root)
root.config(menu=menubar)
menubar.add_cascade(label="Books", menu=book_menu)
menubar.add_cascade(label="Issue/Return", menu=issue_menu)
33 | P a g e
# Adding new menu items
menubar.add_cascade(label="Students", menu=student_menu)
root.mainloop()
34 | P a g e
SQL Tables
35 | P a g e
Books
Issued_books
36 | P a g e
Students
37 | P a g e
Output
38 | P a g e
Home screen
39 | P a g e
Add Book
40 | P a g e
41 | P a g e
Search Book
42 | P a g e
Show Book List
43 | P a g e
Issue Book
44 | P a g e
45 | P a g e
Return Book
46 | P a g e
47 | P a g e
Show Student Details
48 | P a g e
49 | P a g e
Show Issued Book list
50 | P a g e
Conclusion and Future Advancements
This Library Management System successfully addresses the critical aspects of
library management by automating core tasks, enhancing data accuracy, and
improving the overall user experience for library staff. The LMS provides significant
advantages over manual management, including reduced human error, a centralized
database for all book and member information, and streamlined borrowing and
return processes. It efficiently meets the needs of smaller libraries, providing
essential functions in a structured and user-friendly environment. However, as
libraries continue to evolve in the digital age, there is room for future advancements
to keep up with growing demands and expectations.
One potential area for improvement is the integration of an online platform, allowing
users to access the library catalog, check book availability, and reserve books
remotely. This feature would require additional work to establish a secure connection
between the user’s interface and the library’s database, but it would offer
convenience and accessibility, enhancing the LMS's reach. Additionally,
implementing an email or SMS notification system could alert users about due dates
or overdue fines, encouraging timely returns and improving book circulation rates.
51 | P a g e
Another possible enhancement is the addition of analytics features, allowing library
staff to generate reports on book popularity, genre demand, and borrowing patterns.
These insights could inform purchasing decisions and better resource allocation,
ensuring the library’s collection aligns with the needs and interests of its members.
Furthermore, integrating barcode or RFID scanning technology would streamline the
check-in/check-out process, reducing the time required to manually enter book IDs
and further minimizing human error.
For larger libraries, an upgraded version of the LMS could incorporate cloud-based
storage, enabling multiple branches to access a centralized database. Cloud
integration would also provide data backup and recovery options, ensuring that all
records remain secure and available even in the event of local system failure. This
type of advancement would be ideal for libraries with multiple locations, allowing for
a unified system across all branches.
52 | P a g e
In terms of technical architecture, converting the LMS to a web-based application or
mobile app could make it platform-independent and more accessible. By
transitioning to a web framework such as Django or Flask, the system could provides
a seamless experience across various devices, from desktops to smartphones,
catering to the needs of users and staff who may prefer to manage library tasks on-
the-go.
Overall, this Library Management System has achieved its primary goals of
simplifying library operations and improving the accuracy of resource tracking.
However, with the inclusion of advanced features and modern technologies, it has
the potential to evolve into a comprehensive tool capable of meeting the demands of
larger libraries and a digitally-oriented user base. By exploring these future
advancements, the LMS can continue to provide invaluable support to library staff
and enhance the experience for users, ultimately contributing to a more connected
and efficient library environment
53 | P a g e
Bibliography
• https://www.geeksforgeeks.org/mysql-tutorial/
• https://www.geeksforgeeks.org/mysql-tutorial/
• https://www.tutorialspoint.com/python/python_gui_programming.ht
m
54 | P a g e