0% found this document useful (0 votes)
101 views17 pages

Contact Managment

This contact management system allows users to add, view, and manage contact details in a database. It includes code to create a database table to store contact information, functions to insert new contacts, reset form fields, and exit the program. The Tkinter module is used to create the graphical user interface, including frames, labels, text entry boxes and buttons to add new contacts and view the contact list.

Uploaded by

Aagash Pranav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views17 pages

Contact Managment

This contact management system allows users to add, view, and manage contact details in a database. It includes code to create a database table to store contact information, functions to insert new contacts, reset form fields, and exit the program. The Tkinter module is used to create the graphical user interface, including frames, labels, text entry boxes and buttons to add new contacts and view the contact list.

Uploaded by

Aagash Pranav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Introduction:

This programme helps the user to manage the contacts of their friends and relatives. After
adding information this programme automatically store the contact details in the database.the
user can view ,add the contact details anytime.

Objective of the program:


The objective of the project is to let the contact management application tracks your business
contact information. It is a database for the communications you make daily, including
names, addresses, emails, and phone numbers. You can use a contact manager to easily
organize and find all the information linked to business communications.

In recruiting, you can use a contact management tool to keep track of candidate and client
contact information. The application integrates all your contact information for different job
orders.
Contact management is the process of storing and tracking data on customers and leads.
In addition to providing quick access to customer data, investing in contact management can
help you grow and diversify your customer base.
Upgrading to customer relationship management software can provide advanced data that
allows you to increase engagement between your company and its customers.
This article is for business owners who want to improve their customer relationships using
contact management software.
Gone are the days of exchanging napkin notes and business cards. In today’s fast-paced
business world, it can be hard to remember every customer’s name and their individual
preferences. That’s why it’s essential to store data electronically, share it with team members
when needed and continuously gather information to successfully interact with clients and
customers.
Track communication data
The main purpose of contact management is to record and organize your contacts. Details
within the software could include calls, tasks, job orders, and opportunities. All verbal and
email communications can be documented in a CM system. This makes it easy to see who
you’ve talked to and what you’ve talked about.

Along with basic contacts, you can keep notes about your interactions within the software.
This allows you to keep a full record of all your recruiting communications. Instead of losing
data in stacks of paper or spreadsheets, all your information is in one, streamlined database.
System development life cycle (sdlc):

An effective System Development Life Cycle (SDLC) should result in a high quality system
that meets customer expectations, reaches completion within time and cost evaluations, and
works effectively and efficiently in the current and planned Information Technology
infrastructure.

System Development Life Cycle (SDLC) is a conceptual model which includes policies and
procedures for developing or altering systems throughout their life cycles.

SDLC is used by analysts to develop an information system. SDLC includes the following
activities −

requirements
 Design
 Implementation
 Testing
 Deployment
 Operations
 Maintenance
 System Design
 Includes the design of application, network, databases, user interfaces, and system
interfaces.

 Transform the SRS document into logical structure, which contains detailed and
complete set of specifications that can be implemented in a programming language.

 Create a contingency, training, maintenance, and operation plan.Review the proposed


design. Ensure that the final design must meet the requirements stated in SRS
document.Finally, prepare a design document which will be used during next phases.

Tkinter Programming
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides
a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented
interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the
following steps −
 Import the Tkinter module.
 Create the GUI application main window.
 Add one or more of the above-mentioned widgets to the GUI application.
 Enter the main event loop to take action against each event triggered by the user.
Example
#!/usr/bin/python
import Tkinter
top = Tkinter.Tk()
# Code to add widgets will go here...
top.mainloop()
This would create a following window −

Code flow: Contact Management System in python with


source code Importing the libraries
Importing the libraries
#Importing the modules
import tkinter
import tkinter.ttk as ttk
from tkinter import *
import sqlite3
import tkinter.messagebox as tkMessageBox

Declaring the variables for the contact management system python program
# Variables required for storing the values
f_name = StringVar()
m_name = StringVar()
l_name = StringVar()
age = StringVar()
home_address = StringVar()
gender = StringVar()
phone_number = StringVar()
Code for exit function of a system
#Function for exiting the system
def Exit():
O = tkinter.messagebox.askyesno("Contact Management System", "Do you want to exit the
system")
if O > 0:
root.destroy()
return
Code for database and table creation
def Database():
connectn = sqlite3.connect("contactdata.db")
cursor = connectn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS `contactinformation` (id INTEGER
NOT NULL PRIMARY KEY AUTOINCREMENT, first_name TEXT, middle_name TEXT,
last_name TE# For creating the database and the table
XT, gender TEXT, age TEXT, home_address TEXT, phone_number TEXT)")
cursor.execute("SELECT * FROM `contactinformation` ORDER BY `last_name` ASC")
fetchinfo = cursor.fetchall()
for data in fetchinfo:
Resetting the values in the system
#Function for resetting the values
def Reset():
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
Code for database and table creation
# For creating the database and the table
def Database():
connectn = sqlite3.connect("contactdata.db")
cursor = connectn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS `contactinformation` (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)")
cursor.execute("SELECT * FROM `contactinformation` ORDER BY `last_name` ASC")
fetchinfo = cursor.fetchall()
for data in fetchinfo:
tree.insert('', 'end', values=(data))
cursor.close()
connectn.close()

Code for inserting contacts in the system


Insert Query for inserting into the database
#Insert query for inserting the value in database Table
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() == "":
msgg = tkMessageBox.showwarning('', 'Please Complete All the Fields', icon="warning")
else:
tree.delete(*tree.get_children())
connectn = sqlite3.connect("contactdata.db")
cursor = connectn.cursor()

cursor.execute("INSERT INTO `contactinformation` (first_name, middle_name, last_name,


gender, age, home_address, phone_number ) 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())))

connectn.commit()
cursor.execute("SELECT * FROM `contactinformation` ORDER BY `last_name` ASC")
fetchinfo = cursor.fetchall()

for data in fetchinfo:


tree.insert('', 'end', values=(data))
cursor.close()
connectn.close()
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
Module for frame, labels, text entry, and button for adding new contact form window
#For creating the frame, labels, text entry, and button for add new contact form window
def MyNewContact():
global opennewwindow
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")

Opennewwindow = Toplevel()
Opennewwindow.title("Contact Details")
Opennewwindow.resizable(0, 0)
Opennewwindow.geometry("500x500+0+0")
if 'UpdateWindow' in globals():
UpdateWindow.destroy()

#############Frames####################
FormTitle = Frame(Opennewwindow)
FormTitle.pack(side=TOP)
ContactForm = Frame(Opennewwindow)
ContactForm.pack(side=TOP, pady=10)
RadioGroup = Frame(ContactForm)
Male = Radiobutton(RadioGroup, text="Male", variable=gender, value="Male",
font=('Calibri', 14)).pack(side=LEFT)
Female = Radiobutton(RadioGroup, text="Female", variable=gender, value="Female",
font=('Calibri', 14)).pack(side=LEFT)
# ===================LABELS==============================
label_title = Label(FormTitle, text="Adding New Contacts", bd=12, fg="black",
bg="Lightgreen",
font=("Calibri", 15, "bold"), pady=2)
label_title.pack(fill=X)
label_FirstName = Label(ContactForm, text="First Name", font=('Calibri', 14), bd=5)
label_FirstName.grid(row=0, sticky=W)

label_MiddleName = Label(ContactForm, text="Middle Name", font=('Calibri', 14), bd=5)


label_MiddleName.grid(row=1, sticky=W)

label_LastName = Label(ContactForm, text="Last Name", font=('Calibri', 14), bd=5)


label_LastName.grid(row=2, sticky=W)

label_Gender = Label(ContactForm, text="Gender", font=('Calibri', 14), bd=5)


label_Gender.grid(row=3, sticky=W)

label_Age = Label(ContactForm, text="Age", font=('Calibri', 14), bd=5)


label_Age.grid(row=4, sticky=W)

label_HomeAddress = Label(ContactForm, text="Home Address", font=('Calibri', 14), bd=5)


label_HomeAddress.grid(row=5, sticky=W)

label_PhoneNumber = Label(ContactForm, text="Phone Number", font=('Calibri', 14), bd=5)


label_PhoneNumber.grid(row=6, sticky=W)
# ===================ENTRY===============================
FirstName = Entry(ContactForm, textvariable=f_name, font=('Calibri', 14, 'bold'), bd=3,
width=20, justify='left')
FirstName.grid(row=0, column=1)

MiddleName = Entry(ContactForm, textvariable=m_name, font=('Calibri', 14, 'bold'), bd=3,


width=20, justify='left')
MiddleName.grid(row=1, column=1)

LastName = Entry(ContactForm, textvariable=l_name, font=('Calibri', 14, 'bold'), bd=3,


width=20, justify='left')
LastName.grid(row=2, column=1)

RadioGroup.grid(row=3, column=1)

Age = Entry(ContactForm, textvariable=age, font=('Calibri', 14, 'bold'), bd=3, width=20,


justify='left')
Age.grid(row=4, column=1)

HomeAddress = Entry(ContactForm, textvariable=home_address, font=('Calibri', 14, 'bold'),


bd=3, width=20, justify='left')
HomeAddress.grid(row=5, column=1)

PhoneNumber = Entry(ContactForm, textvariable=phone_number, font=('Calibri', 14, 'bold'),


bd=3, width=20, justify='left')
PhoneNumber.grid(row=6, column=1)

# ==================BUTTONS==============================
ButtonAddContact = Button(ContactForm, text='Please Save', bd=5, font=('Calibri', 12,
'bold'), fg="black",
bg="lightgreen", command=Submit)
ButtonAddContact.grid(row=7, columnspan=2, pady=10)
code for updating the contacts in the system
Update Query for updating the database
#Update Query for updating the table in the database
def Update():
if gender.get() == "":
msgg = tkMessageBox.showwarning('', 'Please Complete The Required Field',
icon="warning")
else:
tree.delete(*tree.get_children())
connectn = sqlite3.connect("contactdata.db")
cursor = connectn.cursor()
cursor.execute("UPDATE `contactinformation` SET `first_name` = ?, `middle_name` = ? ,
`last_name` = ?, `gender` =?, `age` = ?, `home_address` = ?, `phone_number` = ? 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()), int(id)))
connectn.commit()
cursor.execute("SELECT * FROM `contactinformation` ORDER BY `last_name` ASC")
fetchinfo = cursor.fetchall()
for data in fetchinfo:
tree.insert('', 'end', values=(data))
gender1 = gender.get()
if not gender1:
tkMessageBox.showerror("Please select the gender")

cursor.close()
connectn.close()

f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
Module to update contact form window
#Module for the update contact form window
def UpdateContact(event):
global id, UpdateWindow
curItem = tree.focus()
contents = (tree.item(curItem))
item = contents['values']
id = item[0]
f_name.set("")
m_name.set("")
l_name.set("")
gender.set("")
age.set("")
home_address.set("")
phone_number.set("")
f_name.set(item[1])
m_name.set(item[2])
l_name.set(item[3])

age.set(item[5])
home_address.set(item[6])
phone_number.set(item[7])

UpdateWindow = Toplevel()
UpdateWindow.title("Contact Information")
UpdateWindow.geometry("500x520+0+0")
UpdateWindow.resizable(0, 0)
if 'Opennewwindow' in globals():
Opennewwindow.destroy()

The code after execution gives the following result:

Delete query for deleting the database


#Delete query for deleting the value
def Delete():
if not tree.selection():
msgg = tkMessageBox.showwarning('', 'Please Select the data!', icon="warning")
else:
msgg = tkMessageBox.askquestion('', 'Are You Sure You Want To Delete',
icon="warning")
if msgg == 'yes':
curItem = tree.focus()
contents = (tree.item(curItem))
item = contents['values']
tree.delete(curItem)
connectn = sqlite3.connect("contactdata.db")
cursor = connectn.cursor()
cursor.execute("DELETE FROM `contactinformation` WHERE `id` = %d" % item[0])
connectn.commit()
cursor.close()
connectn.close()
Output

Code for creating a table in the contact management system window


#creating a tables in contact management system
scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)
scrollbary = Scrollbar(TableMargin, orient=VERTICAL)
tree = ttk.Treeview(TableMargin, columns=("Id", "First Name", "Middle Name", "Last
Name", "Gender", "Age", "Home Address", "Phone Number"),
height=400, selectmode="extended", yscrollcommand=scrollbary.set,
xscrollcommand=scrollbarx.set)
scrollbary.config(command=tree.yview)
scrollbary.pack(side=RIGHT, fill=Y)
scrollbarx.config(command=tree.xview)
scrollbarx.pack(side=BOTTOM, fill=X)

tree.heading('Id', text="Id", anchor=W)


tree.heading('First Name', text="First Name" ,anchor=W)
tree.heading('Middle Name', text="Middle Name", anchor=W)
tree.heading('Last Name', text="Last Name", anchor=W)
tree.heading('Gender', text="Gender", anchor=W)
tree.heading('Age', text="Age", anchor=W)
tree.heading('Home Address', text="Home Address", anchor=W)
tree.heading('Phone Number', text="phone Number", anchor=W)

tree.column('#0', stretch=NO, minwidth=0, width=0)


tree.column('#1', stretch=NO, minwidth=0, width=0)
tree.column('#2', stretch=NO, minwidth=0, width=80)
tree.column('#3', stretch=NO, minwidth=0, width=120)
tree.column('#4', stretch=NO, minwidth=0, width=90)
tree.column('#5', stretch=NO, minwidth=0, width=80)
tree.column('#6', stretch=NO, minwidth=0, width=30)
tree.column('#7', stretch=NO, minwidth=0, width=120)

tree.pack()
tree.bind('<Double-Button-1>', Update tree.insert('', 'end', values=(data))
cursor.close() connectn.close()
Bibliography
 https://itsourcecode.com
 https://www.wikipedia.org/
 https://realpython.com/python-idle/
 https://opensource.com/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy