0% found this document useful (0 votes)
38 views33 pages

Atul Soni Python Project Final Report

This document describes a courier management system project created in Python. It includes the names and details of the students who created the project, as well as information about the college and class. The summary describes how the project allows users to track packages and view the current status of deliveries. It was developed using the Python programming language along with the Tkinter GUI library and SQLite3 database. The document then provides an overview of the project, including its name, type, languages and tools used. It also outlines the key features and benefits of a courier management system, such as safely transporting products and meeting delivery deadlines. Finally, the document walks through the code for the project, explaining how it imports
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)
38 views33 pages

Atul Soni Python Project Final Report

This document describes a courier management system project created in Python. It includes the names and details of the students who created the project, as well as information about the college and class. The summary describes how the project allows users to track packages and view the current status of deliveries. It was developed using the Python programming language along with the Tkinter GUI library and SQLite3 database. The document then provides an overview of the project, including its name, type, languages and tools used. It also outlines the key features and benefits of a courier management system, such as safely transporting products and meeting delivery deadlines. Finally, the document walks through the code for the project, explaining how it imports
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/ 33

Name - Atul Soni, Rupesh Kumar,

Ashish Kumar
Reg. no. - 12115448
Section - K21QT
Roll no. - A33
Subject - Python(project)
Teacher - Er. Navpreet Rupal
Topic - Courier Management System
College - Lovely Professional University
About Courier Management

In the Courier Management System project in Python, we


are going to learn about how to create a management
system to track packages or couriers that are delivered to
a specific destination. How does the consignment is
tracked and what is the current status of the package? All
these things we are going to learn in our article ex.
Courier Management System Project in Python with
source code.

The Package delivery Management System Project In


Python is developed using Python Programming,
This Project along with source code is created using
Graphical User Interface (GUI) Tkinter and connected to
the database using SQLlite3. This project is good for
beginners or students and also for final-year students
who want to learn Python Programming Language.
PROJECT OVERVIEW

Project Name: Courier management system


Abstract: A GUI Based Program in
Python.
Language: Python, Tkinter
IDE: Pycharm(recommended)
Database: Sqlite3
Python version: 3.8
Type: 2nd year project
Features and benefits of Courier/Package
Management System

The basic task to be performed on this Project are:


1. Create an account if you are a new user and log
in if you are already registered.
2. Add all the details of the user who wants to
track the courier or package delivered to the
destination.
3. Check the current status of the package.

 Transport products safely. Courier management


teams aren’t typically responsible for packaging
goods, but they do need to make sure products are
protected during transport. Depending on what
you’re transporting, you may need insulated bags
for food storage, cushioned packaging for breakable
goods, or tall dividers for flower deliveries.

 Consistently meet or surpass due dates and


times. More than half of online shoppers
say delivery turnaround time defines a positive
experience, and 89% of consumers report ditching
a brand because of poor customer experience. You
need to optimize delivery routes, assign deliveries
in priority order, and take every step you can
to maximize your delivery speed if you want to have
a high level of customer satisfaction.
Code flow: Courier Management System in
python with source code
Importing the libraries

from tkinter import *


from tkinter import messagebox as ms
from tkinter import ttk
import sqlite3
import random
from tkinter import Button

Explanation:
The import function includes these modules in the
project
These modules are used for the following
purposes:
1. Tkinter – To create the GUI.
2. SQLite3 – To connect the program to the
database and store information in it.
3. Tkinter.messagebox – To show a display box,
displaying some information or an error or warning
4. Tkinter.ttk – To create the tree where all the
information will be displayed.
5. random–  It is an inbuilt module of Python which
is used to generate random numbers
Creating the database and table for the courier
management system

with sqlite3.connect('record123.db') as db:


c = db.cursor()
try:
c.execute('CREATE TABLE IF NOT EXISTS user (username
TEXT NOT NULL ,password TEX NOT NULL,mobile TEX NOT
NULL);')
except:
pass
db.commit()
db.close()

Explanation:
Here we have created a database “record123” and
performed the database connection with sqlite3.
This is stored in a variable db. After that, the
cursor object c is created for executing the
queries. In the try block, we are using the execute
method in which we are creating a table user if it
doesn’t exist else it will do nothing i.e pass. The
commit() is used to save the changes.
Declaring the variables required for the project

class main:
def __init__(self, master):

self.master = master

self.username = StringVar()
self.password = StringVar()
self.n_username = StringVar()
self.n_password = StringVar()
self.n_reg = StringVar()
self.n_mobile = StringVar()
self.mobile11 = StringVar()

Explanation:
In this code block, we have declared the main
class, where we have defined a init method in
which the variables of string type have been
declared. The self parameter is a reference to the
current instance of the class and is used to access
variables that belong to the class.

Code for creating Login function


def login(self):
with sqlite3.connect('record123.db') as db:
c = db.cursor()
# Find the correct user
find_user = ('SELECT * FROM user WHERE username
= ? and password = ?')
c.execute(find_user, [(self.username.get()),
(self.password.get())])
result = c.fetchall()

if result:
self.track()
else:
ms.showerror('Oops!', 'Check the username
again.')

Explanation:
Here, in the function def login(self): We are working on
our database created in sqlite3 i.e record123.db . The
find_user is the variable that stored the value on the
execution of the query. The query is used to check
whether the user with the username and password we
provide is already present in the database. If it is present
it will fetch all the data with fetchall() method and store
the output in the variable result. If the result is present
then it will track else it will show an error msg “’Oops!’,
‘Username Not Found.”.
Output

Develop a code for creating a new user account


def new_user(self):
with sqlite3.connect('record123.db') as db:
c = db.cursor()
if self.n_username.get() != ' ' and
self.n_password.get() != ' ' and self.n_mobile.get() != '
':
find_user = ('SELECT * FROM user WHERE
username = ?')
c.execute(find_user,
[(self.n_username.get())])

if c.fetchall():
ms.showerror('Error!', 'Username is
already taken.')
else:
insert = 'INSERT INTO
user(username,password,mobile) VALUES(?,?,?)'
c.execute(insert,
[(self.n_username.get()), (self.n_password.get()),
(self.n_mobile.get())])
db.commit()

ms.showinfo('Congrats!', 'Account
Created!')
self.log()
else:
ms.showerror('Error!', 'Please Enter the
details.')

Explanation:
def new_user(self): In this code block, we are
creating a new user if not created in our database
record123.db. For that, we will create a new
account that stores the information of the user
such as name, password, registration number,
gender, mobile no, and email where the name,
password, and mobile number are used to track
the package.
In the if the block it will check whether the user
with the username is present it will be stored in the
variable find_user. If the user is already present it
will print the message ‘Error!’, ‘Username is
already Taken.‘
Else create a new account by clicking on “New
User”. Store the values. Once it’s done it will show
a message” ‘Success!’, ‘Account Created!‘.else
it will show a msg “Error!’, ‘Please Enter the
details.’

Output:
Code to track the courier/package

def consignment(self):

try:
with sqlite3.connect('record123.db') as db:
c = db.cursor()

# Find user If there is any take proper action


find_user = ('SELECT * FROM user WHERE mobile=
?')
c.execute(find_user, [(self.mobile11.get())])
result = c.fetchall()

if result:
self.track()
self.crff.pack_forget()
self.head['text'] = self.username.get() +
'\n Your Product Details'
self.consi.pack()
else:
ms.showerror('Oops!', 'Mobile Number Not
Found.')
except:
ms.showerror('Oops!', 'Mobile Number Not
Found.')

Explanation:
def consignment(self): In this code block, we are
making use of the database record123.db.Here we
will check for the mobile number and consignment
number while tracking, if the mobile number is
present in the database all the details related to
the mobile number are fetched in the result. If the
result is true it will show the product details else
will show an error message as “’Oops!’, ‘Mobile
Number Not Found.’

Output

Code to view the tracking information


def track1(self):
self.consi.pack_forget()
self.head['text'] = self.username.get() + '\n
Product Tracking Information'
self.crff.pack()

def log(self):
self.username.set('')
self.password.set('')
self.crf.pack_forget()
self.head['text'] = 'Login'
self.logf.pack()

def create(self):
self.n_username.set('')
self.n_password.set('')
self.logf.pack_forget()
self.head['text'] = 'Open your Account'
self.crf.pack()

def track(self):
self.logf.pack_forget()
self.head['text'] = self.username.get() + '\n
Tracking the Product'
self.crff.pack()
Explanation:

def track(self): It checks for the tracking of the


package. The “text” variable takes the username
and Tracks the product.
def log(self): The log function is used for the login
page takes the username and password and the
“text” variable takes the “Login” text for logging to
the page.
def create(self): It is used for creating the account. 

Module containing frames, text, labels, and buttons of the


courier management system in python
def widgets(self):
self.head = Label(self.master, text='LOGIN THE
PAGE', font=('Calibri', 18), pady=15)
self.head.pack()

self.logf = Frame(self.master, padx=50, pady=50)

self.logf.configure(background='skyblue')

Label(self.logf, text='Username: ', font=('', 12),


pady=4, padx=4,bg='SkyBlue').grid(sticky=W)
Entry(self.logf, textvariable=self.username, bd=3,
font=('', 15)).grid(row=0, column=1)
Label(self.logf, text='Password: ', font=('', 12),
pady=4, padx=4,bg='SkyBlue').grid(sticky=W)
Entry(self.logf, textvariable=self.password, bd=3,
font=('', 15), show='*').grid(row=1, column=1)
Button(self.logf, text=' Enter Login ',
background='lightgrey', bd=4, font=('', 13), padx=5,
pady=5,
command=self.login).grid(row=8, column=0)
Button(self.logf, text=' New Registration ',
background='lightgrey', bd=4, font=('', 13), padx=6,
pady=6,
command=self.create).grid(row=8, column=1)

self.logf.pack()

self.crf = Frame(self.master, padx=60,


pady=60,bg='lightgreen')
Label(self.crf, text='Username: ',
font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crf, textvariable=self.n_username,
bd=3, font=('', 15)).grid(row=0, column=1)

Label(self.crf, text='Password: ',


font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crf, textvariable=self.n_password,
bd=3, font=('', 15), show='*').grid(row=1, column=1)
Label(self.crf, text='Mobile No.: ',
font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crf, textvariable=self.n_mobile, bd=3,
font=('', 15)).grid(row=2, column=1)

Label(self.crf, text='Registration No.: ',


font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crf, textvariable=self.n_reg, bd=3,
font=('', 15)).grid(row=3, column=1)
Label(self.crf, text='Email Id: ',
font=('Calibri', 15), pady=5, padx=5,
bg='lightgreen').grid(sticky=W)
Entry(self.crf, bd=3, font=('', 15)).grid(row=4,
column=1)

Label(self.crf, text='Gender: ', font=('Calibri',


15), pady=5, padx=5,bg='lightgreen').grid(sticky=W)
var = IntVar()
R1 = Radiobutton(self.crf, text="Male",
variable=var,
value=1,bg='lightgreen').grid(row=5,column=1)

R2 = Radiobutton(self.crf, text="Female",
variable=var, value=2,bg='lightgreen').grid(row=5,
column=2)

Button(self.crf, text='Create My Account',


background='lightgrey', bd=2, font=('Calibri', 13),
padx=8, pady=8,
command=self.new_user).grid(row=11,
column=0)
Button(self.crf, text='Back to Login',
background='lightgrey', bd=2, font=('Calibri', 13),
padx=8, pady=8,
command=self.log).grid(row=11, column=2)
self.crff = Frame(self.master, padx=80,
pady=80,bg='lightgreen')

Label(self.crff, text='Reference No: ',


font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crff, bd=3, font=('Calibri',
15)).grid(row=0, column=1)
Label(self.crff, text='Mobile no:',
font=('Calibri', 15), pady=5,
padx=5,bg='lightgreen').grid(sticky=W)
Entry(self.crff, bd=3, textvariable=self.mobile11,
font=('Calibri', 15)).grid(row=1, column=1)
Button(self.crff, text='Track',
background='steelBlue', bd=2, font=('Calibri', 13),
padx=6, pady=6,
command=self.consignment).grid(row=4,
column=0)

self.consi = Frame(self.master, padx=80,


pady=80,bg='lightgreen')

Label(self.consi, text='Product ID:',


font=('Calibri', 13),bg='lightgreen').grid(sticky=W)
Label(self.consi, text=random.randint(500000,
99994216), font=('Calibri',
13),bg='lightgreen').grid(row=0, column=1)
L = ['Shoes', 'Brushes', 'Purse', 'Vivo', 'Jeans',
'baby wash', 'Mac', 'Ipad', 'Saree', 'Book', 'shirt']
f = random.randint(0, 10)
Label(self.consi, text='Product is : ',
font=('Calibri', 13),bg='lightgreen').grid(sticky=W)
Label(self.consi, text=L[f], font=('Calibri',
13),bg='lightgreen').grid(row=1, column=1)
Label(self.consi, text='Status: ',
font=('Calibri', 13),bg='lightgreen').grid(sticky=W)
Label(self.consi, text='Pending,On the way',
font=('Calibri', 13),bg='lightgreen').grid(row=2,
column=1)
Label(self.consi, font=('Calibri', 13),
text='Thank You',bg='lightgreen').grid(row=5, column=0)
Button(self.consi, text='Back', background='lightgrey',
bd=2, font=('', 13),
command=self.track1).grid(row=6, column=0)

 Explanation:
Here we have provided all the widgets that are
required for the form creation of login, tracking,
and delivery. We are using the randint function of
the random module for randomly selecting the
product numbers and we have defined the 10
products which the system selects randomly while
executing the program.
Output

Creating a display window


if __name__ == '__main__':
root = Tk()
root.title('Tracking the Product')
root.geometry('800x450+0+0')

Explanation:
Here we have defined the main function, where
The root window is created. The root window is the
main application window in our programs. We
have defined the title of the window as “Track
consignment”. The window size is defined using
the geometry function. The root.mainloop() is
simply a method in the main window that executes
what we wish to execute in an application.

Complete source code for courier


management system using Tkinter in
python
#Import the modules

from tkinter import *

from tkinter import messagebox as ms

from tkinter import ttk

import sqlite3

import random

from tkinter import Button

# Database

with sqlite3.connect('record123.db') as db:

c = db.cursor()

try:

c.execute('CREATE TABLE IF NOT EXISTS user (username


TEXT NOT NULL ,password TEX NOT NULL,mobile TEX NOT
NULL);')

except:

pass

db.commit()

db.close()

class main:
def __init__(self, master):

self.master = master

self.username = StringVar()

self.password = StringVar()

self.n_username = StringVar()

self.n_password = StringVar()

self.n_reg = StringVar()

self.n_mobile = StringVar()

self.mobile11 = StringVar()

self.widgets()

def login(self):

with sqlite3.connect('record123.db') as db:

c = db.cursor()

# Find the correct user


find_user = ('SELECT * FROM user WHERE username
= ? and password = ?')

c.execute(find_user, [(self.username.get()),
(self.password.get())])

result = c.fetchall()

if result:

self.track()

else:

ms.showerror('Oops!', 'Check the username again.')

def new_user(self):

with sqlite3.connect('record123.db') as db:

c = db.cursor()

if self.n_username.get() != ' ' and self.n_password.get() != '


' and self.n_mobile.get() != ' ':

find_user = ('SELECT * FROM user WHERE username


= ?')

c.execute(find_user, [(self.n_username.get())])

if c.fetchall():
ms.showerror('Error!', 'Username is already taken.')

else:

insert = 'INSERT INTO


user(username,password,mobile) VALUES(?,?,?)'

c.execute(insert, [(self.n_username.get()),
(self.n_password.get()), (self.n_mobile.get())])

db.commit()

ms.showinfo('Congrats!', 'Account Created!')

self.log()

else:

ms.showerror('Error!', 'Please Enter the details.')

def consignment(self):

try:

with sqlite3.connect('record123.db') as db:

c = db.cursor()

# Find user If there is any take proper action

find_user = ('SELECT * FROM user WHERE


mobile= ?')
c.execute(find_user, [(self.mobile11.get())])

result = c.fetchall()

if result:

self.track()

self.crff.pack_forget()

self.head['text'] = self.username.get() + '\n Your


Product Details'

self.consi.pack()

else:

ms.showerror('Oops!', 'Mobile Number Not Found.')

except:

ms.showerror('Oops!', 'Mobile Number Not Found.')

def track1(self):

self.consi.pack_forget()

self.head['text'] = self.username.get() + '\n Product


Tracking Information'

self.crff.pack()

def log(self):
self.username.set('')

self.password.set('')

self.crf.pack_forget()

self.head['text'] = 'Login'

self.logf.pack()

def create(self):

self.n_username.set('')

self.n_password.set('')

self.logf.pack_forget()

self.head['text'] = 'Open your Account'

self.crf.pack()

def track(self):

self.logf.pack_forget()

self.head['text'] = self.username.get() + '\n Tracking the


Product'

self.crff.pack()

def widgets(self):
self.head = Label(self.master, text='LOGIN THE PAGE',
font=('Calibri', 18), pady=15)

self.head.pack()

self.logf = Frame(self.master, padx=50, pady=50)

self.logf.configure(background='skyblue')

Label(self.logf, text='Username: ', font=('', 12), pady=4,


padx=4,bg='SkyBlue').grid(sticky=W)

Entry(self.logf, textvariable=self.username, bd=3,


font=('', 15)).grid(row=0, column=1)

Label(self.logf, text='Password: ', font=('', 12), pady=4,


padx=4,bg='SkyBlue').grid(sticky=W)

Entry(self.logf, textvariable=self.password, bd=3,


font=('', 15), show='*').grid(row=1, column=1)

Button(self.logf, text=' Enter Login ',


background='lightgrey', bd=4, font=('', 13), padx=5, pady=5,

command=self.login).grid(row=8, column=0)

Button(self.logf, text=' New Registration ',


background='lightgrey', bd=4, font=('', 13), padx=6, pady=6,

command=self.create).grid(row=8, column=1)

self.logf.pack()
self.crf = Frame(self.master, padx=60,
pady=60,bg='lightgreen')

Label(self.crf, text='Username: ', font=('Calibri', 15),


pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crf, textvariable=self.n_username, bd=3,


font=('', 15)).grid(row=0, column=1)

Label(self.crf, text='Password: ', font=('Calibri', 15),


pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crf, textvariable=self.n_password, bd=3,


font=('', 15), show='*').grid(row=1, column=1)

Label(self.crf, text='Mobile No.: ', font=('Calibri', 15),


pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crf, textvariable=self.n_mobile, bd=3, font=('',


15)).grid(row=2, column=1)

Label(self.crf, text='Registration No.: ', font=('Calibri',


15), pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crf, textvariable=self.n_reg, bd=3, font=('',


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

Label(self.crf, text='Email Id: ', font=('Calibri', 15),


pady=5, padx=5, bg='lightgreen').grid(sticky=W)

Entry(self.crf, bd=3, font=('', 15)).grid(row=4, column=1)


Label(self.crf, text='Gender: ', font=('Calibri', 15),
pady=5, padx=5,bg='lightgreen').grid(sticky=W)

var = IntVar()

R1 = Radiobutton(self.crf, text="Male", variable=var,


value=1,bg='lightgreen').grid(row=5,column=1)

R2 = Radiobutton(self.crf, text="Female", variable=var,


value=2,bg='lightgreen').grid(row=5, column=2)

Button(self.crf, text='Create My Account',


background='lightgrey', bd=2, font=('Calibri', 13), padx=8,
pady=8,

command=self.new_user).grid(row=11, column=0)

Button(self.crf, text='Back to Login',


background='lightgrey', bd=2, font=('Calibri', 13), padx=8,
pady=8,

command=self.log).grid(row=11, column=2)

self.crff = Frame(self.master, padx=80,


pady=80,bg='lightgreen')
Label(self.crff, text='Reference No: ', font=('Calibri', 15),
pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crff, bd=3, font=('Calibri', 15)).grid(row=0,


column=1)

Label(self.crff, text='Mobile no:', font=('Calibri', 15),


pady=5, padx=5,bg='lightgreen').grid(sticky=W)

Entry(self.crff, bd=3, textvariable=self.mobile11,


font=('Calibri', 15)).grid(row=1, column=1)

Button(self.crff, text='Track', background='steelBlue',


bd=2, font=('Calibri', 13), padx=6, pady=6,

command=self.consignment).grid(row=4,
column=0)

self.consi = Frame(self.master, padx=80,


pady=80,bg='lightgreen')

Label(self.consi, text='Product ID:', font=('Calibri',


13),bg='lightgreen').grid(sticky=W)

Label(self.consi, text=random.randint(500000,
99994216), font=('Calibri', 13),bg='lightgreen').grid(row=0,
column=1)

L = ['Shoes', 'Brushes', 'Purse', 'Vivo', 'Jeans', 'baby


wash', 'Mac', 'Ipad', 'Saree', 'Book', 'shirt']

f = random.randint(0, 10)
Label(self.consi, text='Product is : ', font=('Calibri',
13),bg='lightgreen').grid(sticky=W)

Label(self.consi, text=L[f], font=('Calibri',


13),bg='lightgreen').grid(row=1, column=1)

Label(self.consi, text='Status: ', font=('Calibri',


13),bg='lightgreen').grid(sticky=W)

Label(self.consi, text='Pending,On the way',


font=('Calibri', 13),bg='lightgreen').grid(row=2, column=1)

Label(self.consi, font=('Calibri', 13), text='Thank


You',bg='lightgreen').grid(row=5, column=0)

Button(self.consi, text='Back', background='lightgrey',


bd=2, font=('', 13),

command=self.track1).grid(row=6, column=0)

if __name__ == '__main__':

root = Tk()

root.title('Tracking the Product')

root.geometry('800x450+0+0')
root.mainloop()

Summary

In this article, we have learned to develop


the package or courier management system using
python programming language and using the GUI
Tkinter module connecting to the SQLite3
database and performing the functions of the
product tracking.
Output of Project

You might also like