Address Book Project In Python With Source Code

The Address Book Project In Python is written in Python programming language, this Address Book Python Project is an interesting project.

The user can add the phone number of contact details and you can see the details stored in the list form. The user can delete the contact records if he/she wants to remove it.

This is a simple GUI-based project which is very easy to understand and use. 

Creating an Address Book in Python – Project Information

Project Name:Address Book In Python
Language/s Used:Python (GUI) Based
Python version (Recommended):2.x or 3.x
Database:None
Type:Python App
Developer:IT SOURCECODE
Updates:0

A Python Address Book Example feature is the user can make a list of contacts with their name, and address, and keep them as records.

You just have to type the contact information in the text fields and click on the add button to add the information to the record.

Also, this Address Book In Python includes a downloadable Address Book Python Code for free, just find the downloadable source code below and click to start downloading.

To start creating an Address Book In Python, make sure that you have PyCharm IDE installed on your computer.

Steps In Creating an Address Book In Python with Source Code

Time needed: 5 minutes

These are the steps In Creating an Address Book In Python With Source Code

  • Step 1: Create a project name.

    First, open Pycharm IDE and then create a “project name.” After creating a project name click the “create” button.
    Address Book In Python Project Name

  • Step 2: Create a python file.

    Second, after creating a project name, “right click” your project name and then click “new.” After that click the “python file“.
    Address Book In Python File

  • Step 3: Name your python file.

    Third, after creating a Python file, Name your Python file after that click “enter“.
    Address Book In Python File Name

  • Step 4: The actual code.

    You are free to copy the code given below and download the full source code below.

Code Explanations

1. Importing Libraries

Code:

import sys

sys.path.insert(0, 'GUI')

import tkinter as Tk
import db
import new

Explanation:

In the code given which is importing the given libraries.

2. The Code Given Below Is For The Get Data Module

Code:

def get_contact(contact):
    """Returns a contact.

    Keyword arguments:
    contact -- First and Last name of a contact entry
    """
    entry = []

    try:
        if contact.split()[1]:
            entry.append(contact.split()[0])
            entry.append(contact.split()[1])
    except:
        entry.append('')
        entry.append(contact.split()[0])

    for row in db.get_entry(db.get_id(entry)):
        return row

Explanation:

In this module which is the module for getting contact.

3. The Code Given Below Is For The Adding Data Module

Code:

def add_contact(contact):
    """Adds a contact to the database.

    Keyword arguments:
    contact -- List containing contact entry information
    """
    db.insert_entry(contact)

Explanation:

This module is the module for adding the data.

4. The Code Given Below Is For The Removing Data Module

Code:

def remove_contact(contact):
    """Removes a contact.

    Keyword arguments:
    contact -- First and Last name of a contact entry
    """
    entry = []
    try:
        entry.append(contact.split()[0])
    except:
        entry.append('')

    try:
        entry.append(contact.split()[1])
    except:
        entry.append('')

    db.delete_entry(db.get_id(entry))

Explanation:

This module is the module for removing the data.

5. The Code Given Below Is For The Modify Module

Code:

def edit_contact(entry_id, contact):
    """Edits a contact.

    Keyword arguments:
    entry_id -- rowid for contact entry
    contact -- List containing contact entry information
    """
    db.edit_entry(entry_id, contact)

Explanation:

This module is the module for modifying the data.

6. The Code Given Below Is For The Search Module

Code:

def search(search_string, sort):
    """Searches the database and returns the results.

    Keyword arguments:
    search_string -- (str) Search term
    sort -- (str) Sorting method (Last Name or Zip)
    """
    return db.search_entry(search_string, sort)

Explanation:

This module is the module for searching the data that is stored in the SQLite database.

Complete Source Code

import sys

sys.path.insert(0, 'GUI')

import tkinter as Tk
import db
import new


def get_contact(contact):
    """Returns a contact.

    Keyword arguments:
    contact -- First and Last name of a contact entry
    """
    entry = []

    try:
        if contact.split()[1]:
            entry.append(contact.split()[0])
            entry.append(contact.split()[1])
    except:
        entry.append('')
        entry.append(contact.split()[0])

    for row in db.get_entry(db.get_id(entry)):
        return row


def add_contact(contact):
    """Adds a contact to the database.

    Keyword arguments:
    contact -- List containing contact entry information
    """
    db.insert_entry(contact)


def remove_contact(contact):
    """Removes a contact.

    Keyword arguments:
    contact -- First and Last name of a contact entry
    """
    entry = []
    try:
        entry.append(contact.split()[0])
    except:
        entry.append('')

    try:
        entry.append(contact.split()[1])
    except:
        entry.append('')

    db.delete_entry(db.get_id(entry))


def edit_contact(entry_id, contact):
    """Edits a contact.

    Keyword arguments:
    entry_id -- rowid for contact entry
    contact -- List containing contact entry information
    """
    db.edit_entry(entry_id, contact)


def search(search_string, sort):
    """Searches the database and returns the results.

    Keyword arguments:
    search_string -- (str) Search term
    sort -- (str) Sorting method (Last Name or Zip)
    """
    return db.search_entry(search_string, sort)


if __name__ == "__main__":
    root = Tk.Tk()
    new.New_AddBookWindow(root)
    root.mainloop()

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.

Summary

The Address Book Project In Python is written in Python programming language, Python Code Project is very smooth to research the syntax emphasizes readability and it is able to reduce time ingesting in developing.

Also, in this tutorial is the simplest way for beginners or students to enhance their logical skills in programming. Also, this System project is a way for the students or beginners to design and develop the systems.

Inquiries

If you have any questions or suggestions about the Address Book Project In Python, please feel free to leave a comment below.

Leave a Comment