Library Management System
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.
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)
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
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