0% found this document useful (0 votes)
3 views

Library Management System

The document outlines the design and implementation of a Library Management System using Python and PyQt5, focusing on functionalities such as adding, updating, deleting, searching, and exporting book records. It includes details on the tools used, system requirements, and a description of the graphical user interface. The project aims to provide a user-friendly solution for managing library records effectively.

Uploaded by

osesayjr
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Library Management System

The document outlines the design and implementation of a Library Management System using Python and PyQt5, focusing on functionalities such as adding, updating, deleting, searching, and exporting book records. It includes details on the tools used, system requirements, and a description of the graphical user interface. The project aims to provide a user-friendly solution for managing library records effectively.

Uploaded by

osesayjr
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Library Management System

Objective
The objective of this project is to design and implement a Library
Management System using Python and PyQt5. This system allows users to
manage book records with essential functionalities like adding, updating,
deleting, searching, and exporting book data. The project emphasizes
building a graphical user interface (GUI) for efficient and user-friendly
interaction.

Tools and Technologies Used


 Programming Language: Python 3.7+
Libraries:
 PyQt5: For building the GUI.
 sqlite3: For database management.
 Development Environment: Any Python-compatible IDE (e.g.,
PyCharm).

Features
Add Book:
 Allows users to add new books with details such as Title, Author, Year,
and ISBN.
Update Book:
 Enables modification of existing book records.
Delete Book:
 Removes selected books from the database.
Search Books:
 Users can search for books by Title, Author, Year, or ISBN using a
search bar.
Clear Search:
 Resets the search query to display all books.
Export to CSV:
 Saves the library records to a CSV file for external use.
Book Table:
 Displays all books in a tabular format with columns for ID, Title, Author,
Year, and ISBN.

System Requirements
Operating System: Windows
Python Version: 3.7 or higher.

Functionality Description
Graphical User Interface (GUI)

The interface consists of:


Toolbar:
 A search bar and buttons for Search and Clear Search at the top-right.
Input Form:
 Fields to input Title, Author, Year, and ISBN.
 Buttons for Add, Update, Delete, and Export to CSV below the form.
Book Table:
 A table displaying all book records with columns: ID, Title, Author, Year,
and ISBN.
 CRUD Operations
Add Book:
 Enter book details in the form and click Add Book to save it to the
database.
Update Book:
 Select a book from the table, modify its details in the form, and click
Update Book.
Delete Book:
 Select a book from the table and click Delete Book to remove it from
the database.
 Search and Clear Search

Search:
 Enter a query (e.g., Title, Author, Year, or ISBN) in the search bar and
click the Search button.
 The table will filter to show matching results.
Clear Search:
 Click the Clear Search button to reset the query and display all books.
Export to CSV
 Click Export to CSV to save the book records as a CSV file.

Code Overview

Database Manager (database_manager.py)


 Handles all database operations using SQLite, including:
 Creating the books table.
 Adding, updating, deleting, and fetching book records.

User Interface (ui_library.py)


 Defines the GUI and its functionalities:
 Toolbar with search and clear search buttons.
 Input fields for managing book details.
 Table to display book records.
 Event handlers for CRUD operations and CSV export.

Main Script (main.py)


 Initializes and runs the PyQt5 application.

Sample Code Snippets

Add Book Functionality


def add_book(self):
title = self.title_input.text()
author = self.author_input.text()
year = self.year_input.text()
isbn = self.isbn_input.text()

if not title or not author or not year.isdigit() or not isbn:


QMessageBox.warning(self, "Warning", "Please fill all fields correctly!")
return

self.db_manager.add_book(title, author, int(year), isbn)


self.load_books()
QMessageBox.information(self, "Success", "Book added successfully!")
self.clear_form()
Search Functionality
def search_books(self):
search_query = self.search_bar.text().strip()
if not search_query:
QMessageBox.warning(self, "Warning", "Please enter a search query!")
return

filtered_books = [
book for book in self.db_manager.get_books()
if search_query.lower() in str(book).lower()
]
self.book_table.setRowCount(len(filtered_books))
for row_index, book in enumerate(filtered_books):
for col_index, data in enumerate(book):
self.book_table.setItem(row_index, col_index,
QTableWidgetItem(str(data)))
Clear Search Functionality
def clear_search(self):
self.search_bar.clear()
self.load_books()
Conclusion
The Library Management System provides a robust solution for managing
book records. It integrates a database with a user-friendly GUI to perform
essential operations seamlessly. This project demonstrates the practical
application of Python, PyQt5, and SQLite to create real-world software.

References
PyQt5 Documentation
SQLite Documentation

You might also like