0% found this document useful (0 votes)
10 views61 pages

Dummy Python Project

This document certifies that Sahadri Jain completed an original project on 'Contact Management' under the guidance of Mr. Brandavan Tyagi for the CBSE Board Examination 2020-2021. It includes acknowledgments, project contents, user-defined functions in Python, file handling, string manipulation methods, and data structures. The project aims to create a simple GUI-based contact management system that allows users to add, view, update, and delete contacts.

Uploaded by

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

Dummy Python Project

This document certifies that Sahadri Jain completed an original project on 'Contact Management' under the guidance of Mr. Brandavan Tyagi for the CBSE Board Examination 2020-2021. It includes acknowledgments, project contents, user-defined functions in Python, file handling, string manipulation methods, and data structures. The project aims to create a simple GUI-based contact management system that allows users to add, view, update, and delete contacts.

Uploaded by

Harsh Amera
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CERTIFICATE

This is hereby to certify that this Informatics Practices project


on “Contact Management” is an original and genuine
investigation work carried out to investigate about the subject
matter and the related data collection and investigation has
been completed solely, sincerely and satisfactorily by
Sahadri Jain of Class XII under guidance of Mr.
Brandavan Tyagi, lecturer Informatics Practices
Department,Vidyasthali Public School. This project is carried
as per requirement for the CBSE Board of Examination for
the year 2020- 2021.

Mr. Brandavan Tyagi


Lect. I.P. Department
Vidyasthali Public School
Jaipur(Raj.)

1
ACKNOWLEDGEMENT

I would like to express a deep sense of thanks & gratitude to my


project guide Mr. Brandavan Tyagi for guiding me immensely
through the course of the project. He always evinced keen interest in
my work. His constructive advice & constant motivation have been
responsible for the successful completion of this project.
I also thanks to my parents for their motivation & support. I must
thanks to my class mates for their timely help & support for
completion of this project.
Last but not the least I would like to thanks all those who had helped
directly or indirectly in the completion of this project.

SAHADRI JAIN
(XII Commerce)

2
CONTENTS

1. USER DEFINED FUNCTIONS THAT ARE USED


IN PROJECT MODULE
2. TEXT FILES
3. INTRODUCTION TO PROJECT
4. SOURCE CODE
5. INPUT/OUTPUT INTERFACE
6. BIBLIOGRAPHY

3
USER DEFINED FUNCTIONS

A function is a block of code which only runs when it is called.


You can pass data, known as parameters, into a function.
A function can return data as a result.

[Link] a Function
In Python a function is defined using the def keyword:
eg:
def my_function():
print(“Hello you are creating a function”)

[Link] a Function
To call a function, use the function name followed by parenthesis:
eg:
def my_function():
print(“Hello you are creating a function”)

my_function()

[Link]
Information can be passed into function as arguments.
Arguments are specified after the function name,inside the [Link]
can add as many arguments as you want, just separate them with a comma.

4
The following example has a function with one argument (fname).When the
function is called, we pass along a first name, which is used inside the
function to print the full name:
eg:
def my_function(fname):
print(fname + “Agrawal”)

my_function(“Anjali”)
my_function(“Aashi”)
my_function(“Raj”)

Parameters or Arguments?
A parameter is the variable listed inside the parentheses in the function
definition. An argument is the value that are sent to the function when it is
called.

Number of Arguments
By default, a function must be called with the correct number of arguments.
Meaning that if your function expects 2 arguments, you have to call the
function with 2 arguments, not more, and not less.
eg:
This function expects 2 arguments and gets 2 arguments.
def my_function(fname, lname):
print(fname + “” + lname)
my_function(“Anjali”, “Agrawal”)
5
If you try to call the function with 1 or 3 arguments, you will get an error:
eg:
This function expects 2 arguments but gets only 1.
def my_function(fname, lname):
print(fname + “” + lname)
my_function(“Anjali”)

[Link] Values
To let a function return a value, use return the statement:
eg:
def my_function(a):
return 5 * a
print(my_function(3))
print(my_function(5))
print(my_function(9))

[Link] pass Statement


Function definitions cannot be empty, but if you for some reason have a
function definition with no content, put in the pass statement to avoid getting
an error.
eg:
def my_function():
pass

6
TEXT FILES

1. [Link]
Exception Handling:
Error handling in Python is done through the use of exceptions that are caught in try
blocks and handled in except blocks.

Syntax:
try:
# statement that may raise error
except:
# handle exception here
finally:
# statement that will always run

try and except :

If an error is encountered, a try block code execution is stopped and transferred


down to the except block. In addition to using an except block after the try block, you
can also use the finally block. The code in the finally block will be executed regardless
of whether an exception occurs.

Raising an Exception :

You can raise an exception in your program by using your own statement:
raise exception[, value]
Raising an exception breaks current code execution and returns the exception
back until it is handled.
7
Example:

A try block look like below


try:
print "Hello World"
except:
print "This is an error message!"

Some Exceptions

EXCEPTION NAME DESCRIPTION


overflowError() Raised when a calculation exceeds maximum
limit for a numeric type.

0ZeroDivisonError() Raised when division or modulo by zero takes place


for all numeric types.

EOFError() Raised when there is no input from either the


raw_input() or input() function and the end of file is reached.
ImportError() Raised when an import statement fails.

IndexError() Raised when an index is not found in a sequence.

NameError() Raised when an identifier is not found in the local or


global namespace.

IOError() Raised when an input/ output operation fails, such as


the print statement or the open() function when trying to open a
file that does not exist.
TypeError() Raised when an operation or function is attempted that
is invalid for the specified data type.

ValueError() Raised when the built-in function for a data type has the
valid type of arguments, but the arguments have invalid values

8
Generators
A generator is simply a function which returns an object on which you can call next,
such that for every call it returns some value, until it raises a StopIteration exception,
signaling that all values have been generated. Such an object is called an iterator.
Normal functions return a single value using return, just like in Java. In Python,
however, there is an alternative, called yield. Using yield anywhere in a function makes
it a generator

EXAMPLE:
>>> def myGen(n):
... yield n
... yield n + 1
...
>>> g = myGen(6)
>>> next(g)
6
>>> next(g)
7

2. R_W.txt

Opening :

The first thing to do when you are working with files in Python isto open thefile. When
you open the files, you can specify with parameters how you want to open them.

The "r" is for reading, the "w" for writing and the "a" for appending.
9
Read mode:

fh=open(“filename_here”, “r”)

This opens the filename for reading. By default, the file is opened with the "r"
parameter.

Write mode:

fh = open("filename_here", "w")

This opens the the file for writing. It will create the file if it doesn't exist, and if it does,
it will overwrite it.

Append mode:

fh =open("filename_here", "a")

This opens the file in appending mode. That means, it will be open for writing and
everything will be written to the end of the file.

Closing:

It is always necessary to close a file when all the work is completed in order to prevent
it from external access and data loss.

[Link]()

This closes the file and is used when the program doesn't need it more.

Reading and Writing


Reading from file :

Functions available for reading the files: read, readline and readlines.

10
read(): reads all characters (unless you specify other)

eg:

fh = open("filename", "r")

content = [Link]()

readlines(): reads a single line from the file

eg:

fh = open("filename", "r")

content = [Link]()

readlines(): returns a list containing all the lines of data in the file. The readlines
function reads all rows and retains the newlines character that is at the end of every row.

eg:

fh = open("filename", "r")

content = [Link]()

print [Link]()

print content[:-1]

Writing from files:

The functions for writing are write and writelines

write(): write a fixed sequence of characters to a file

eg:

fh = open("[Link]","w")

write("Hello World")
11
writeline(): write a list of strings to a file

eg:

fh = open("[Link]", "w")

lines_of_text = ["a line of text", "another line of text", "a third line"]

[Link](lines_of_text)

3. M_FUN.txt
Function defined in module:

A module allows you to logically organize your Python code. Grouping related code
into a module makes the code easier to understand and use. A module is a Python object
with arbitrarily named attributes that you can bind and reference.

Simply, a module is a file consisting of Python code. A module can define functions,
classes and variables. A module can also include runnable code.

Example:

The Python code for a module named aname normally resides in a file named
[Link].

Here's an example of a simple module, [Link]

def print_func( par ):

print "Hello : ", par

return

The import Statement :

You can use any Python source file as a module by executing an import statement in
some other Python source file. The import has the following syntax:

import module1[, module2[,... moduleN]

12
When the interpreter encounters an import statement, it imports the module if the
module is present in the search path. A search path is a list of directories that the
interpreter searches before importing a module. For example, to import the module
[Link], you need to put the following command at the top of the script -

# Import module support

>>>import support

# Now you can call defined function that module as follows

support.print_func("Zara")

When the above code is executed, it produces the following result -

>>>Hello : Zara

A module is loaded only once, regardless of the number of times it is imported. This
prevents the module execution from happening over and over again if multiple imports
occur.

4. S_FUN.txt
String Manipulation Methods:
1. [Link]():

Returns a copy ofstring with first character capitalised.

[Link]():

Return a copy of s, but with lower case letters converted to upper case

[Link](s[, chars]):

Return a copy of the string with leading characters removed. If chars is omitted or
None, whitespace characters are removed. If given and not None, chars must be a
string; the characters in the string will be stripped from the beginning of the string this
method is called on.

[Link](s[, chars]):

13
Return a copy of the string with trailing characters removed. If chars is omitted or
None, whitespace characters are removed. If given and not None, chars must be a
string; the characters in the string will be stripped from the end of the string this method
is call.

[Link](s):

Return a copy of s, but with upper case letters converted to lower case.

[Link](s, sub[, start[, end]]):

Return the lowest index in s where the substring sub is found such that sub is wholly
contained in s[start:end]. Return -1 on failure. Defaults for start and end and
interpretation of negative values is the same as for slices.

[Link]():

This method checks if the string is in lowercase and returns true if all the characters are
in lowercase.

[Link]():

This method checks if all the characters in the string are in uppercase. If any character is
in lower case, it would return false otherwise true.

5. D_T.txt
DATA STRUCTURES :

Python offers 5 different types of data structure.

1. ARRAY:

Array refers to a named list of finite number n of similar data elements. Each of the data
elements can be referenced respectively by a set of consecutive numbers, usually
0,1,2,3,4 . . . n .
e.g.

14
A array ar containing 10 elements will be referenced as

ar[0] , ar[1] , ar[2] . . . ar[9]

2. STACKS:

Stacks data structure refer to list stored and accessed in a special way,
where LIFO(Last In First Out) technique is followed. In stack insertion and deletion
take place at only one end called the top.

3. QUEUES:

Queues data structure are FIFO(First In First Out ) lists , where


take place at "rear" end of queue deletions take place at the "front" end
of the queue.

4. LINKED LIST:
Linked lists are special list of some data elements linked to one another.
The logical ordering is represented by having each element pointing to
next element. Each element is called a 'node' which has the parts.
The INFO part which stores the information and the reference pointer part i.e stores
reference of next element.

[Link]:

Trees are multilevel data structures having a hierarchical relationship amongst its
element called 'node'. Topmost node is called node of the tree and bottom most node of
tree is called leaves of tree. Each node have some reference pointers pointing to node
below it.

15
6. [Link]
This project has been created to fulfill the requirement of the CBSE Senior Secondary
Examination Class XII for Informatics Practices. This project is been created by Anjali
Agrawal of class XII under the guidance of Mr. Brandavan Tyagi sir .This project is
aimed to build a contact management system.

INTRODUCTION TO PROJECT

Contact Management System project is written in Python. The project file


contains a python script ([Link]). This is a simple GUI based project which is
very easy to understand and use. Talking about the system, it contains all the
required functions which include adding, viewing, deleting and updating contact
lists. While adding the contact of a person, he/she has to provide first name, last
name, gender, address and contact details. The user can also update the contact list if
he/she wants to. For this, the user has to double-click on a record that he/she wishes to
edit. The system shows the contact details in a list view. And also the user easily delete
any contact details.

This GUI based Contact Management system provides the simplest management
of contact details. In short, this projects mainly focus on CRUD (Create Read
Update Delete) operations. There’s an external database connection file used in
this mini project to save user’s data permanently.

16
Features of this project:
1. Add Contacts

2. List Contacts

3. Update Contacts

4. Delete Contacts

Modules used:
1. Tkinter
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

eg:

import Tkinter

top = [Link]()

# Code to add widgets will go here...


17
[Link]()

This would create a following window −

Tkinter Widgets
Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI

application. These controls are commonly called widgets.

There are currently following types of widgets in Tkinter. We present these widgets as

well as a brief description in the following table −


18
Operator & Description

1. Button

The Button widget is used to display buttons in your application.

2. Canvas

The Canvas widget is used to draw shapes, such as lines, ovals, polygons and

rectangles, in your application.

3. Checkbutton

The Checkbutton widget is used to display a number of options as

checkboxes. The user can select multiple options at a time.

4. Entry

The Entry widget is used to display a single-line text field for accepting

values from a user.

5. Frame

The Frame widget is used as a container widget to organize other widgets.

6. Label

The Label widget is used to provide a single-line caption for other widgets. It

can also contain images.

7. Listbox

The Listbox widget is used to provide a list of options to a user.

19
8. Menubutton

The Menubutton widget is used to display menus in your application.

9. Menu

The Menu widget is used to provide various commands to a user. These

commands are contained inside Menubutton.

10. Message

The Message widget is used to display multiline text fields for accepting

values from a user.

11. Radiobutton

The Radiobutton widget is used to display a number of options as radio

buttons. The user can select only one option at a time.

12. Scale

The Scale widget is used to provide a slider widget.

13. Scrollbar

The Scrollbar widget is used to add scrolling capability to various widgets,

such as list boxes.

14. Text

The Text widget is used to display text in multiple lines.

15. Toplevel

The Toplevel widget is used to provide a separate window container.

16. Spinbox

The Spinbox widget is a variant of the standard Tkinter Entry widget, which

can be used to select from a fixed number of values.

20
17. PanedWindow

A PanedWindow is a container widget that may contain any number of

panes, arranged horizontally or vertically.

18. LabelFrame

A labelframe is a simple container widget. Its primary purpose is to act as a

spacer or container for complex window layouts.

19. tkMessageBox

This module is used to display message boxes in your applications.

2. Sqlite
What is SQLite

SQLite is a software library that provides a relational database management


system. The lite in SQLite means light weight in terms of setup, database
administration, and required resource.

SQLite has the following noticeable features: self-contained, serverless, zero-


configuration, transactional.

Serverless
Normally, an RDBMS such as MySQL, PostgreSQL, etc., requires a separate
server process to operate. The applications that want to access the database server use
TCP/IP protocol to send and receive requests. This is called client/server architecture.

The following diagram illustrates the RDBMS client/server architecture:

21
SQLite does NOT work this way.

SQLite does NOT require a server to run.

SQLite database is integrated with the application that accesses the database. The
applications interact with the SQLite database read and write directly from the database
files stored on disk.

The following diagram illustrates the SQLite server-less architecture:

22
Self-Contained
SQLite is self-contained means it requires minimal support from the operating system
or external library. This makes SQLite usable in any environments especially in
embedded devices like iPhones, Android phones, game consoles, handheld media
players, etc.

SQLite is developed using ANSI-C. The source code is available as a big sqlite3.c and
its header file sqlite3.h. If you want to develop an application that uses SQLite, you just
need to drop these files into your project and compile it with your code.

Zero-configuration
Because of the serverless architecture, you don’t need to “install” SQLite before using
it. There is no server process that needs to be configured, started, and stopped. In
addition, SQLite does not use any configuration files.

Transactional
All transactions in SQLite are fully ACID-compliant. It means all queries and changes
are Atomic, Consistent, Isolated, and Durable.

In other words, all changes within a transaction take place completely or not at all even
when an unexpected situation like application crash, power failure, or operating system
crash occurs.
23
SQLite distinctive features
SQLite uses dynamic types for tables. It means you can store any value in any column,
regardless of the data type.

SQLite allows a single database connection to access multiple database files


simultaneously. This brings many nice features like joining tables in different databases
or copying data between databases in a single command.

SQLite is capable of creating in-memory databases which are very fast to work with.

SOURCE CODE

from tkinter import *

import sqlite3

import [Link] as ttk

import [Link] as tkMessageBox


24
root = Tk()

[Link]("Contact List")

width = 700

height = 400

screen_width = root.winfo_screenwidth()

screen_height = root.winfo_screenheight()

x = (screen_width/2) - (width/2)

y = (screen_height/2) - (height/2)

[Link]("%dx%d+%d+%d" % (width, height, x, y))

[Link](0, 0)

[Link](bg="#6666ff")

#============================VARIABLES=======================

============

FIRSTNAME = StringVar()

LASTNAME = StringVar()

GENDER = StringVar()

AGE = StringVar()

ADDRESS = StringVar()
25
CONTACT = StringVar()

#============================METHODS========================
=============

def Database():

conn = [Link]("[Link]")

cursor = [Link]()

[Link]("CREATE TABLE IF NOT EXISTS `member` (mem_id INTEGER

NOT NULL PRIMARY KEY AUTOINCREMENT, firstname TEXT, lastname

TEXT, gender TEXT, age TEXT, address TEXT, contact TEXT)”)

[Link]("SELECT * FROM `member` ORDER BY `lastname` ASC")

fetch = [Link]()

for data in fetch:

[Link]('', 'end', values=(data))

[Link]()

[Link]()

def SubmitData():

if [Link]() == "" or [Link]() == "" or [Link]() == "" or

[Link]() == "" or [Link]() == "" or [Link]() == "":

26
result = [Link]('', 'Please Complete The Required Field',
icon="warning")

else:

[Link](*tree.get_children())

conn = [Link]("[Link]")

cursor = [Link]()

[Link]("INSERT INTO `member` (firstname, lastname, gender, age,

address, contact) VALUES(?, ?, ?, ?, ?, ?)", (str([Link]()),

str([Link]()), str([Link]()), int([Link]()), str([Link]()),

str([Link]())))

[Link]()

[Link]("SELECT * FROM `member` ORDER BY `lastname` ASC")

fetch = [Link]()

for data in fetch:

[Link]('', 'end', values=(data))

[Link]()

[Link]()

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

27
def UpdateData():

if [Link]() == "":

result = [Link]('', 'Please Complete The Required Field',

icon="warning")

else:

[Link](*tree.get_children())

conn = [Link]("[Link]")

cursor = [Link]()

[Link]("UPDATE `member` SET `firstname` = ?, `lastname` = ?, `gender`

=?, `age` = ?, `address` = ?, `contact` = ? WHERE `mem_id` = ?",

(str([Link]()), str([Link]()), str([Link]()), str([Link]()),

str([Link]()), str([Link]()), int(mem_id)))

[Link]()

[Link]("SELECT * FROM `member` ORDER BY `lastname` ASC")

fetch = [Link]()

for data in fetch:

[Link]('', 'end', values=(data))

[Link]()

[Link]()

[Link]("")

[Link]("")

[Link]("")

[Link]("")

28
[Link]("")

[Link]("")

def OnSelected(event):

global mem_id, UpdateWindow

curItem = [Link]()

contents =([Link](curItem))

selecteditem = contents['values']

mem_id = selecteditem[0]

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link](selecteditem[1])

[Link](selecteditem[2])

[Link](selecteditem[4])

[Link](selecteditem[5])

[Link](selecteditem[6])

UpdateWindow = Toplevel()

[Link]("Contact List")

29
width = 400

height = 300

screen_width = root.winfo_screenwidth()

screen_height = root.winfo_screenheight()

x = ((screen_width/2) + 450) - (width/2)

y = ((screen_height/2) + 20) - (height/2)

[Link](0, 0)

[Link]("%dx%d+%d+%d" % (width, height, x, y))

if 'NewWindow' in globals():

[Link]()

#===================FRAMES==============================

FormTitle = Frame(UpdateWindow)

[Link](side=TOP)

ContactForm = Frame(UpdateWindow)

[Link](side=TOP, pady=10)

RadioGroup = Frame(ContactForm)

Male = Radiobutton(RadioGroup, text="Male", variable=GENDER,


value="Male", font=('arial', 14)).pack(side=LEFT)

Female = Radiobutton(RadioGroup, text="Female", variable=GENDER,


value="Female", font=('arial', 14)).pack(side=LEFT)

#===================LABELS==============================

lbl_title = Label(FormTitle, text="Updating Contacts", font=('arial', 16),


30
bg="orange", width = 300)

lbl_title.pack(fill=X)

lbl_firstname = Label(ContactForm, text="Firstname", font=('arial', 14), bd=5)

lbl_firstname.grid(row=0, sticky=W)

lbl_lastname = Label(ContactForm, text="Lastname", font=('arial', 14), bd=5)

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

lbl_gender = Label(ContactForm, text="Gender", font=('arial', 14), bd=5)

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

lbl_age = Label(ContactForm, text="Age", font=('arial', 14), bd=5)

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

lbl_address = Label(ContactForm, text="Address", font=('arial', 14), bd=5)

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

lbl_contact = Label(ContactForm, text="Contact", font=('arial', 14), bd=5)

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

#===================ENTRY===============================

firstname = Entry(ContactForm, textvariable=FIRSTNAME, font=('arial', 14))

[Link](row=0, column=1)

lastname = Entry(ContactForm, textvariable=LASTNAME, font=('arial', 14))

[Link](row=1, column=1)

[Link](row=2, column=1)

age = Entry(ContactForm, textvariable=AGE, font=('arial', 14))

31
[Link](row=3, column=1)

address = Entry(ContactForm, textvariable=ADDRESS, font=('arial', 14))

[Link](row=4, column=1)

contact = Entry(ContactForm, textvariable=CONTACT, font=('arial', 14))

[Link](row=5, column=1)

#==================BUTTONS==============================

btn_updatecon = Button(ContactForm, text="Update", width=50,

command=UpdateData)

btn_updatecon.grid(row=6, columnspan=2, pady=10)

#fn1353p

def DeleteData():

if not [Link]():

result = [Link]('', 'Please Select Something First!',

icon="warning")

else:

result = [Link]('', 'Are you sure you want to delete this

record?', icon="warning")

if result == 'yes':

curItem = [Link]()

contents =([Link](curItem))

32
selecteditem = contents['values']

[Link](curItem)

conn = [Link]("[Link]")

cursor = [Link]()

[Link]("DELETE FROM `member` WHERE `mem_id` = %d" %

selecteditem[0])

[Link]()

[Link]()

[Link]()

def AddNewWindow():

global NewWindow

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

[Link]("")

NewWindow = Toplevel()

[Link]("Contact List")

width = 400

height = 300

screen_width = root.winfo_screenwidth()

33
screen_height = root.winfo_screenheight()

x = ((screen_width/2) - 455) - (width/2)

y = ((screen_height/2) + 20) - (height/2)

[Link](0, 0)

[Link]("%dx%d+%d+%d" % (width, height, x, y))

if 'UpdateWindow' in globals():

[Link]()

#===================FRAMES==============================

FormTitle = Frame(NewWindow)

[Link](side=TOP)

ContactForm = Frame(NewWindow)

[Link](side=TOP, pady=10)

RadioGroup = Frame(ContactForm)

Male = Radiobutton(RadioGroup, text="Male", variable=GENDER,


value="Male",

font=('arial', 14)).pack(side=LEFT)

Female = Radiobutton(RadioGroup, text="Female", variable=GENDER,

value="Female", font=('arial', 14)).pack(side=LEFT)

#===================LABELS==============================

lbl_title = Label(FormTitle, text="Adding New Contacts", font=('arial', 16),


34
bg="#66ff66", width = 300)

lbl_title.pack(fill=X)

lbl_firstname = Label(ContactForm, text="Firstname", font=('arial', 14), bd=5)

lbl_firstname.grid(row=0, sticky=W)

lbl_lastname = Label(ContactForm, text="Lastname", font=('arial', 14), bd=5)

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

lbl_gender = Label(ContactForm, text="Gender", font=('arial', 14), bd=5)

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

lbl_age = Label(ContactForm, text="Age", font=('arial', 14), bd=5)

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

lbl_address = Label(ContactForm, text="Address", font=('arial', 14), bd=5)

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

lbl_contact = Label(ContactForm, text="Contact", font=('arial', 14), bd=5)

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

#===================ENTRY===============================

firstname = Entry(ContactForm, textvariable=FIRSTNAME, font=('arial', 14))

[Link](row=0, column=1)

lastname = Entry(ContactForm, textvariable=LASTNAME, font=('arial', 14))

[Link](row=1, column=1)

35
[Link](row=2, column=1)

age = Entry(ContactForm, textvariable=AGE, font=('arial', 14))

[Link](row=3, column=1)

address = Entry(ContactForm, textvariable=ADDRESS, font=('arial', 14))

[Link](row=4, column=1)

contact = Entry(ContactForm, textvariable=CONTACT, font=('arial', 14))

[Link](row=5, column=1)

#==================BUTTONS==============================

btn_addcon = Button(ContactForm, text="Save", width=50, command=SubmitData)

btn_addcon.grid(row=6, columnspan=2, pady=10)

#============================FRAMES==========================

============

Top = Frame(root, width=500, bd=1, relief=SOLID)

[Link](side=TOP)

Mid = Frame(root, width=500, bg="#6666ff")

36
[Link](side=TOP)

MidLeft = Frame(Mid, width=100)

[Link](side=LEFT, pady=10)

MidLeftPadding = Frame(Mid, width=370, bg="#6666ff")

[Link](side=LEFT)

MidRight = Frame(Mid, width=100)

[Link](side=RIGHT, pady=10)

TableMargin = Frame(root, width=500)

[Link](side=TOP)

#============================LABELS==========================
=

===========

lbl_title = Label(Top, text="Contact Management System", font=('arial', 16),

width=500)

lbl_title.pack(fill=X)

#============================ENTRY===========================

============

#============================BUTTONS=========================
37
============

btn_add = Button(MidLeft, text="+ ADD NEW", bg="#66ff66",

command=AddNewWindow)

btn_add.pack()

btn_delete = Button(MidRight, text="DELETE", bg="red", command=DeleteData)

btn_delete.pack(side=RIGHT)

#============================TABLES==========================
=

===========

scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)

scrollbary = Scrollbar(TableMargin, orient=VERTICAL)

tree = [Link](TableMargin, columns=("MemberID", "Firstname", "Lastname",

"Gender", "Age", "Address", "Contact"), height=400, selectmode="extended",

yscrollcommand=[Link], xscrollcommand=[Link])

[Link](command=[Link])

[Link](side=RIGHT, fill=Y)

[Link](command=[Link])

[Link](side=BOTTOM, fill=X)

[Link]('MemberID', text="MemberID", anchor=W)

[Link]('Firstname', text="Firstname", anchor=W)

[Link]('Lastname', text="Lastname, fill=X)

[Link]('MemberID', text="MemberID", anchor=W)


38
[Link]('Firstname', text="Firstname", anchor=W)

[Link]('Gender', text="Gender", anchor=W)

[Link]('Age', text="Age", anchor=W)

[Link]('Address', text="Address", anchor=W)

[Link]('Contact', text="Contact", anchor=W)

[Link]('#0', stretch=NO, minwidth=0, width=0)

[Link]('#1', stretch=NO, minwidth=0, width=0)

[Link]('#2', stretch=NO, minwidth=0, width=80)

[Link]('#3', stretch=NO, minwidth=0, width=120)

[Link]('#4', stretch=NO, minwidth=0, width=90)

[Link]('#5', stretch=NO, minwidth=0, width=80)

[Link]('#6', stretch=NO, minwidth=0, width=120)

[Link]('#7', stretch=NO, minwidth=0, width=120)

[Link]()

[Link]('<Double-Button-1>', OnSelected)

#============================INITIALIZATION==================
============

if __name__ == '__main__':

Database()

[Link]()

39
40
INPUT/OUTPUT INTERFACE

Fig.1 Project running on python shell

41
42
43
44
45
BIBLIOGRAPHY

1. Sumita Arora (Python)


2. Informatics practices NCERT textbook
3. [Link]
4. [Link]
5. [Link]
6. [Link]
7. [Link]

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
BIBLIOGRAPHY

1. Sumita Arora (Python)


2. [Link]

61

You might also like