The Contact Management System Project in Python With Source Code undertaking project is written in Python. A Contact Management System project report incorporates a python script (Contact-System.Py).
Contact Management System in Python : Project Details and Technology
Project Name: | Contact Management System Python Project |
Abstract | Contact management System in Python is the process of keeping track of the information about contacts and keeping track of how they interact with a business. |
Language/s Used: | Python Programming |
Python version (Recommended): | 3.8 or 3.9 |
Database: | SQLite3 |
Type: | Python Tkinter Based Project |
Developer: | IT SOURCECODE |
Updates: | 0 |
About Contact Management System Python Project
This is a simple GUI based mission that’s very clean to apprehend and use. Talking about the system, it includes all the required features which encompass including, viewing, deleting and updating contact lists.
While including the contact of a person, he/she has to provide first name, closing name, gender, deal with and call info. The user can additionally update the touch list if he/she wishes to.
For this, the person has to double-click on on a file contains a python that he/she wishes to edit.
The Contact Management System shows the touch contact details in a listing view. And additionally the user easily delete any touch info. There’s an external database connection file used in this mini project to save user’s data permanently.
Before you start to create a Contact Management System in Python With Source Code, make sure you have PyCharm IDE, Sqlite3 and installed python on your pc.
Recommendations
By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list of Best Python IDE for Windows, Linux, Mac OS that will suit for you.
I also have here How to Download and Install Latest Version of Python on Windows.
Steps on How To Create Contact Management System Project in Python.
Time needed: 5 minutes
Contact Management System in Python With Source Code
- Step 1: Create a Project Name
First step open the PyCharm IDE and click “File” and select “New Project” and then create a project name after that click the “create” button.
- Step 2: Create a Python File
Second step after creating a project name, “right” click the project name and the click “New” after that choose “Python File“.
- Step 3: Name the Python File
Third step after choose Python File name the file “Contact-System” and then click “Enter“.
- Step 4: The actual code
Now you can start coding, you are free to copy the code that being provided below.
Code Explanations
1. Database Connection
This module is for the database.
def Database():
conn = sqlite3.connect("contactdb.db")
cursor = conn.cursor()
cursor.execute(
"CREATE TABLE IF NOT EXISTS `contactable` (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, first_name TEXT, middle_name TEXT, last_name TEXT, gender TEXT, age TEXT, home_address TEXT, phone_number TEXT, religion TEXT, nationality TEXT)")
cursor.execute("SELECT * FROM `contactable` ORDER BY `last_name` ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
In the code above, This method used for how to create a database name and table name.
2. Insert Module
This module is for Insert Query in a database.
def Submit():
if f_name.get() == "" or m_name.get() == "" or l_name.get() == "" or gender.get() == "" or age.get() == "" or home_address.get() == "" or phone_number.get() == "" or religion.get() == "" or nationality.get() == "":
result = tkMessageBox.showwarning('', 'Please Complete The Required Field', icon="warning")
else:
tree.delete(*tree.get_children())
conn = sqlite3.connect("contactdb.db")
cursor = conn.cursor()
cursor.execute(
"INSERT INTO `contactable` (first_name, middle_name, last_name, gender, age, home_address, phone_number, religion, nationality) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", (str(f_name.get()), str(m_name.get()), str(l_name.get()), str(gender.get()), int(age.get()), str(home_address.get()),
int(phone_number.get()), str(religion.get()), str(nationality.get())))
conn.commit()
cursor.execute("SELECT * FROM `contactable` ORDER BY `last_name` ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
religion.set("")
nationality.set("")
The code above, This method demonstrates how to execute INSERT Query from python to add a new row into MySQLite table.
3. Update Module
This module is for Update Query in a database.
def Update():
if gender.get() == "":
result = tkMessageBox.showwarning('', 'Please Complete The Required Field', icon="warning")
else:
tree.delete(*tree.get_children())
conn = sqlite3.connect("contactdb.db")
cursor = conn.cursor()
cursor.execute(
"UPDATE `contactable` SET `first_name` = ?, `middle_name` = ? , `last_name` = ?, `gender` =?, `age` = ?, `home_address` = ?, `phone_number` = ?, `religion` = ?, `nationality` = ? WHERE `id` = ?",
(str(f_name.get()), str(m_name.get()), str(l_name.get()), str(gender.get()), int(age.get()), str(home_address.get()),
str(phone_number.get()), str(religion.get()), str(nationality.get()), int(id)))
conn.commit()
cursor.execute("SELECT * FROM `contactable` ORDER BY `last_name` ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
religion.set("")
nationality.set("")
The code above, This method used how to UPDATE Query from python to edit a new row into MySQLite table.
4. Delete Function
This module is for delete function in the database table.
def Delete():
if not tree.selection():
result = tkMessageBox.showwarning('', 'Please Select in the Table First!', icon="warning")
else:
result = tkMessageBox.askquestion('', 'Are You Sure You Want To Delete This Record?', icon="warning")
if result == 'yes':
curItem = tree.focus()
contents = (tree.item(curItem))
selecteditem = contents['values']
tree.delete(curItem)
conn = sqlite3.connect("contactdb.db")
cursor = conn.cursor()
cursor.execute("DELETE FROM `contactable` WHERE `id` = %d" % selecteditem[0])
conn.commit()
cursor.close()
conn.close()
In the code above, This method is used to ask the user about some action to which, the user can answer in yes or no. If yes it will delete the contact record in the table and if no it will remain the contact record in the table.
When the above code is executed, it produces the following result below.
Output:
How To Run The Contact Management System Python Project?
To run this project, you must have installed a Pycharm on your PC (for Windows). This Contact Management System Project is free to download, Use for educational purposes only!
After downloading the project you must follow the steps below:
Step 1: Unzip the file or Extract the file
Step 2: Double click the Contact-System
Step 3: Project is ready to run
Downloadable Source Code
I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.
Conclusion
The Contact Management System Project in Python is a easy to understand graphical user interface based mission which may be very comprehensible and utilizes.
Speaking about the system, it consists of all the referred to as for features that consist of adding the contact, viewing, doing away with and additionally upgrading contact lists.
While including the call of a person, he/she has to provide given name, middle name, last name, gender, age, home address, religion, nationality cope with and make contact with information.