Contact Management System Project in Python with MySQL

contact management system project in python using tkinter and mysql database

Introduction

The Contact manager is used to manage people's contact information. In mobiles, there is a by default application that manages this task. It offers to save someone's contact number, email, address, etc. in this application. This application is a very important thing because it's impossible to keep in our mind everyone's personal information. In this tutorial, we'll create such a Contact management system project in python using Tkinter and MySQL database.

Our program handles the following tasks:

Add a new record: Name, Surname, Address, Contact, and Email (a valid email: the program performs this task using regular expressions)

Display contact information: It shows all the records in a table view format, users can select a record to perform a specific task (to update, delete, etc.)

Search a record by the Name or Surname of a person

Update a record: Users need to double-click on a record to perform this operation

Delete a record: The same method as the previous for this task also

Clear the screen

Exit the window

The Project Details

The graphical interface of this contact manager program is managed by the Tkinter library. The PyMySQL package is used here to manage database operations with python. The project folder contains four python files, main.py, custom.py, credentials.py, and validemail.py. As the name of main.py, it handles all the tasks. custom.py has the several information about the color and font used by the main program. credentials.py contains credentials to log in to the MySQL server. validemail.py or the final file checks an email id is valid or not using the regular expressions and returns a bool value.

Since we'll be working with the database, you will need to install a MySQL server on your system. If you already have it, follow the next step.

Create a Database and a Table

Create a database with this name: "contact_management"


create database contact_management;

Create a table "contact_register" under the "contact_management" database.


create table contact_register(
f_name VARCHAR(50) NOT NULL,
l_name VARCHAR(50) NOT NULL,
address VARCHAR(200) NOT NULL,
contact VARCHAR(15) NOT NULL,
email VARCHAR(100) NOT NULL,
PRIMARY KEY ( contact )
);

Requirements and Installation

Use pip3 for Linux and Mac.

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, access data in a python table, retrieve data from a table, update operation, and more.
  • 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.

Source Code

Download the source code from my GitHub page(https://github.com/subhankar-rakshit) through the download button.

Conclusion

In this tutorial, we discussed how to create a contact management system project in python. It's a python project using Tkinter and MySQL that can handle relevant data to contact management. Users need to follow some basic things before using this contact manager application. For example, Installing MySQL server and all required modules or packages, creating a database and a table, etc.

The code length or size is not suitable for copying and pasting. I added my GitHub page link there; you can download the zip file of this project also, through the download button.

I hope you enjoyed this tutorial. If you have any questions about this python project, leave your comments below. You'll receive an immediate response.

Thanks for reading!💙
Subhankar Rakshit

Meet Subhankar Rakshit, a Computer Science postgraduate (M.Sc.) and the creator of PySeek. Subhankar is a programmer, specializes in Python language. With a several years of experience under his belt, he has developed a deep understanding of software development. He enjoys writing blogs on various topics related to Computer Science, Python Programming, and Software Development.

Post a Comment (0)
Previous Post Next Post