Introduction
In the past days, librarians used big sizes notebooks and pens to write down necessary information when a person was borrowed books from a library. Even nowadays many libraries are still following this method.
There are many formalities come under library management; for example, when a person borrows books from a library, the librarians record the book name, user id(for the case of any institute, it becomes roll no. of the student), user name, issue date, return date, etc. It's quite a lengthy task.
To get rid of this problem I developed a Library Management System Project in Python with MySQL. It will help to manage the record of books in a library more easily.
It manages the following tasks:
- Add new books to the database
- Issue books to the users or students
- Take borrowed books from the users or student
- Issue the book again to the person who already has taken that book
- Displays all the book records presented in the library with the total available piece of each book(It shows all the records in a table view format. Users need to select{by double-click} an entity to perform the update and delete operation)
- Search a book by name. In this case, if the user doesn't know the entire name of the book, he/she can search by only a word or characters instead of the entire name of the book
- Update and delete the book records
- Displays the records of all the borrowers with the related information
- Clear the screen
- Exit the window
👉Visit Also: Create an Alarm Clock using Python Tkinter (with Ringtones)
The Project Details
The graphical interface of this project is managed by the Tkinter library. The PyMySQL package is used here to manage database operations using python.
The project folder contains three python files, 'main.py', 'custom.py', and 'credentials.py'.
As the name of 'main.py', it handles all the tasks related to library management. 'custom.py' has several information about the color and font used by the main program(main.py).
'credentials.py' contains credentials to log in to the MySQL Server and users need to enter their own Username and Password to the MySQL server, in this file.
Since we'll be working with the database, you will need to install a MySQL Server on your system (Learn How to Install MySQL on Windows, Linux, and Mac). If you already have done, avoid it.
Create a Database and Two Tables
1. Create a Database with this name: "library_management"
create database library_management;
2. Create a table "book_list" under the "library_management" database
create table book_list(
book_id VARCHAR(10) NOT NULL,
book_name VARCHAR(50) NOT NULL,
author VARCHAR(50) NOT NULL,
edition VARCHAR(10) NOT NULL,
price Int(6) NOT NULL,
qty Int(4) NOT NULL,
PRIMARY KEY ( book_id )
);
3. Create a table "borrow_record" under the same database
create table borrow_record(
book_id VARCHAR(10) NOT NULL,
book_name VARCHAR(50) NOT NULL,
stu_roll VARCHAR(15) NOT NULL,
stu_name VARCHAR(50) NOT NULL,
course VARCHAR(10) NOT NULL,
subject VARCHAR(30) NOT NULL,
issue_date date NOT NULL,
return_date date NOT NULL
);
Requirements and Installation
Install PyMySQL
☛pip install PyMySQL
Install Tkinter
☛pip install tk
What can you learn from this project?
- Creating a graphical interface with Tkinter: Creating Tkinter window, frame, label, input widget, buttons, etc.
- Connecting Python to MySQL: How to connect python to MySQL.
- Database operations in python: Access data from a table, update and delete operations, etc.
- Creating multiple python modules to manage various tasks.
- Object Orient Programming: Using classes, objects, etc.
- Check a valid email id: Using the regular expression in python.
Download the Source Code
You can Download the Project File directly from my GitHub page(https://github.com/subhankar-rakshit) through the download button.
👉Visit Also: Build a PDF Editor using Python (Split, Merge, and Rotate)
Summary
In this tutorial, we build a Library Management System Project in Python. It's a python project using Tkinter and MySQL that can manage relevant data to library management.
You need to follow some basic things before using this application. For example, Installing MySQL server and all required modules and packages, creating a database and tables, etc.
The code is not suitable for copying and pasting because of its length. That is why I've shared my GitHub page link above; you need to download the zip file of this project through the 'Download' button.
If you have any questions related to this python project, just leave your comments below. You'll receive an immediate response.
Find more project related to Python and MySQL from here.
👉Student Management System Project in Python with MySQL
👉Create a Login and Registration form using Python and MySQL
👉Contact Management System Project in Python with MySQLThanks for reading!💙
PySeek
Can I please get the csv files too? Thanks
ReplyDeleteError due to 'NoneType' object is not subscriptable
ReplyDeletewhat's the solution of this problem
Please send me the screenshot of the error message at this email: pyseek89@gmail.com
ReplyDelete