0% found this document useful (0 votes)
218 views

Informatics Practices Project

The document describes a Python project for a shopping mall management system. It includes: - Importing Tkinter, MySQL connector, and other modules for the GUI and database connectivity. - Coding for the login page, product addition module, product deletion, and purchase order generation. Functions are defined for adding products to a MySQL database on clicking a button. Product details get autofilled based on the selected product name.

Uploaded by

Suiana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
218 views

Informatics Practices Project

The document describes a Python project for a shopping mall management system. It includes: - Importing Tkinter, MySQL connector, and other modules for the GUI and database connectivity. - Coding for the login page, product addition module, product deletion, and purchase order generation. Functions are defined for adding products to a MySQL database on clicking a button. Product details get autofilled based on the selected product name.

Uploaded by

Suiana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

INFORMATICS PRACTICES

PROJECT
PYTHON

NAME : Pavithra V
CLASS : XII ‘A’
ROLL NO.: 21
TOPIC : SHOPPING MALL MANAGEMENT SYSTEM
SCHOOL : DAV PUBLIC SCHOOL
YEAR : 2020-21
DESCRIPTION OF THE MODULE/PACKAGE

 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.

 Mysql.connector - MySQL Connector/Python enables Python programs

to access MySQL databases.

 Tkinter.messagebox - The tkMessageBox module is used to display

message boxes in your applications. This module provides a number of

functions that you can use to display an appropriate message.

Some of these functions are showinfo, showwarning, showerror,

askquestion, askokcancel, askyesno, and askretryignore.

 Python imaging library - Python Imaging Library (abbreviated as PIL) (in

newer versions known as Pillow) is a free and open-

source additional library for the Python programming language that

adds support for opening, manipulating, and saving many

different image file formats


CODING FOR SHOPPING MALL
MANAGEMENT SYSTEM
import tkinter as tk

from tkinter import *

from tkinter import ttk

import mysql.connector

import tkinter.messagebox as box

from PIL import ImageTk ,Image

w=Tk()

w.title("Super mall-login page")

w.geometry('700x500')

img1=ImageTk.PhotoImage(Image.open ("D:\\SUPERMALL.jpg"))

title=Label(w,bg="white",fg="dark blue",image=img1).pack(side="top")

Username= Label(w,text='Username',font=('Arial',25),fg='dark
blue',bg='white')

Username.place(x=100,y=210)

u = StringVar()

User= Entry(w, textvariable=u,font=('Arial',15))

User.place(x=300,y=225)

Password= Label(w,text='Password',font=('Arial',25),fg='dark
blue',bg='white')

Password.place(x=100,y=275)

p = StringVar()
passw= Entry(w, textvariable=p, show='*',font=('Arial',15))

passw.place(x=300,y=290)

w.configure(bg='white')

u.get()

p.get()

def add():

win=Tk()

win.title("Product addition")

win.geometry('800x600')

win.configure(bg='white')

P_no=Label(win,text="Product No",font=('Arial',20),bg='white')

P_no.place(x=50,y=50)

P_no_entry=Entry(win,font=('Arial',20),bg='#eee',width=5)

P_no_entry.place(x=50,y=100)

P_name=Label(win,text="Product Name",font=('Arial',20),bg='white')

P_name.place(x=50,y=200)

m= tk.StringVar()

P_name_entry=ttk.Combobox(win,width=25, textvariable = m)

P_name_entry['values']=('Cadbury_Dairy_Milk',

'Amul_Taaza_Milk',

'Aashirvaad_Atta',
'Parachute_Oil',

'Hide_and_Seek',

'Cadbury_Oreo',

'Waffy_Rolls_Tin',

'Fortune_Oil')

P_name_entry.place(x=50,y=250)

P_name_entry.current()

P_quantity=Label(win,text="Quantity",font=('Arial',20),bg='white')

P_quantity.place(x=50,y=350)

P_quantity_entry=Entry(win,font=('Arial',20),bg='#eee',width=5)

P_quantity_entry.place(x=50,y=400)

P_description=Label(win,text="Product
description",font=('Arial',20),bg='white')

P_description.place(x=500,y=50)

P_description_entry=Text(win,width=20,height=7,bg="#eee",font=('Arial',
15))

P_description_entry.place(x=500,y=100)

Manufacturer=Label(win,text="Product
description",font=('Arial',20),bg='white')
Manufacturer.place(x=500,y=250)

Manufacturer_entry=Entry(win,font=('Arial',20),bg='#eee',width=15)

Manufacturer_entry.place(x=500,y=300)

def name():

if P_name_entry.get()=='Cadbury_Dairy_Milk':

P_description_entry.insert(tk.END,"Cadbury Dairy Milk stands for


goodness. A moment of pure magic!")

P_price_entry.insert(tk.END,"50.00")

Manufacturer_entry.insert(tk.END,"Cadbury")

elif P_name_entry.get()=='Amul_Taaza_Milk':

P_description_entry.insert(tk.END,"Pasteurised Milk Amul milk


meets the PFA standards for the respective type of milk.")

P_price_entry.insert(tk.END,"25.00")

Manufacturer_entry.insert(tk.END,"Amul")

elif P_name_entry.get()=='Aashirvaad_Atta':

P_description_entry.insert(tk.END," Aashirvaad Atta ensures that


you and your family stay fit, active and healthy, every day.")

P_price_entry.insert(tk.END,"75.00")

Manufacturer_entry.insert(tk.END,"ITC")

elif P_name_entry.get()=='Parachute_Oil':

P_description_entry.insert(tk.END,"India's No. 1 coconut oil


contains only the goodness of 100% pure coconut oil")
P_price_entry.insert(tk.END,"50.00")

Manufacturer_entry.insert(tk.END,"Marico")

elif P_name_entry.get()=='Hide_and_Seek':

P_description_entry.insert(tk.END,"A meal substitute for some


and a tasty and healthy snack for many others.")

P_price_entry.insert(tk.END,"30.00")

Manufacturer_entry.insert(tk.END,"Parle")

elif P_name_entry.get()=='Cadbury_Oreo':

P_description_entry.insert(tk.END,"Take a delicious break with


an Oreo cookie, the perfect anytime snack.")

P_price_entry.insert(tk.END,"10.00")

Manufacturer_entry.insert(tk.END,"Cadbury")

elif P_name_entry.get()=='Waffy_Rolls_Tin':

P_description_entry.insert(tk.END,"Crispy and crunchy wafers


for moments of lightness and laughter. Take pleasure in between the
thin layers of cream.")

P_price_entry.insert(tk.END,"100.00")

Manufacturer_entry.insert(tk.END,"Dukes")

elif P_name_entry.get()=='Fortune_Oil':

P_description_entry.insert(tk.END,"Fortune Sunflower Oil is a


light, healthy and nutritious cooking oil.")

P_price_entry.insert(tk.END,"86.00")
Manufacturer_entry.insert(tk.END,"Adani")

go=Button(win,text='click after entering product


name',font=('Arial',10),bg="light
blue",command=name).place(x=250,y=250)

P_price=Label(win,text="Price for each",font=('Arial',20),bg='white')

P_price.place(x=500,y=350)

P_price_entry=Entry(win,font=('Arial',20),bg='#eee',width=10)

P_price_entry.place(x=500,y=400)

def my_conn():

my=mysql.connector.connect(host="localhost",

user="root",

password="good",

database="pavithra")

x=my.cursor()

query="INSERT INTO `shopping_mall`


VALUES(%s,%s,%s,%s,%s,%s)"

my_data=(P_no_entry.get(),P_name_entry.get(),P_quantity_entry.get(),
P_price_entry.get(),Manufacturer_entry.get(),P_description_entry.get("1.
0",'end-1c'))

x.execute(query,my_data) # insert data

my.commit()

P_no_entry.delete(0,tk.END)
P_name_entry.delete(0,tk.END)

P_quantity_entry.delete(0,tk.END)

P_description_entry.delete("1.0", "end")

Manufacturer_entry.delete(0,tk.END)

P_price_entry.delete(0,tk.END)

box.showinfo("added","Added succesfully",parent=win)

o=Button(win,text="ADD PRODUCT",font=('Arial',20),bg='light
blue',command=my_conn)

o.place(x=50,y=500)

l=Button(win,text="BACK",font=('Arial',20),bg='light
blue',command=lambda:win.destroy())

l.place(x=500,y=500)

win.mainloop()

def de():

wind=Tk()

wind.title("Delete product")

wind.geometry('400x200')

wind.configure(bg='white')

List=Label(wind,text="Product list",font=('Arial',20),bg='white')

List.place(x=50,y=50)

connection = mysql.connector.connect(host="localhost",

user="root",

password="good",

database="pavithra")
sql_Query = "select Product_name from shopping_mall"

cursor = connection.cursor()

cursor.execute(sql_Query)

record = cursor.fetchall()

Tup1 = ()

def my_connection():

sql_Query = "DELETE FROM shopping_mall WHERE


product_name = '%s'" % list_entry.get()

cursor = connection.cursor()

cursor.execute(sql_Query)

connection.commit()

box.showinfo("Deleted", "Deleted successfully",parent=wind)

for row in record:

Tup1 = [list(row)for row in record]

q= tk.StringVar()

list_entry=ttk.Combobox(wind,width=30, textvariable = q)

if len(Tup1)>0:

list_entry['values']=Tup1

list_entry.place(x=50,y=100)

else:

list_entry['values']=["no products"]

list_entry.place(x=50,y=100)

excuse=Button(wind,text="DELETE",font=('Arial',15),bg='light
blue',command=(my_connection))

excuse.place(x=100,y=140)
wind.mainloop()

def purchase_order():

wins=Tk()

wins.title("Purchase order")

wins.geometry('800x620')

wins.configure(bg='white')

connection = mysql.connector.connect(host="localhost",

user="root",

password="good",

database="pavithra")

sql_Query = "select Product_name from shopping_mall"

cursor = connection.cursor()

cursor.execute(sql_Query)

record = cursor.fetchall()

Tup1 = ()

for row in record:

Tup1 = [list(row)for row in record]

P_List=Label(wins,text="Product list",font=('Arial',20),bg='white')

P_List.place(x=50,y=50)

qs= tk.StringVar()

P_list_entry=ttk.Combobox(wins,width=30, textvariable = qs)

if len(Tup1)>0:

P_list_entry['values']=Tup1

P_list_entry.place(x=50,y=100)
else:

P_list_entry['values']=["no products"]

P_list_entry.place(x=50,y=100)

no=Label(wins,text="Customer No",font=('Arial',20),bg='white')

no.place(x=300,y=50)

no_entry=Entry(wins,font=('Arial',20),bg='#eee',width=5)

no_entry.place(x=300,y=100)

name=Label(wins,text="Product Name",font=('Arial',20),bg='white')

name.place(x=300,y=200)

name_entry=Entry(wins,font=('Arial',20),bg='#eee',width=15)

name_entry.place(x=300,y=250)

quantity=Label(wins,text="Quantity",font=('Arial',20),bg='white')

quantity.place(x=50,y=200)

quantity_entry=Entry(wins,font=('Arial',20),bg='#eee',width=5)

quantity_entry.place(x=50,y=250)

description=Label(wins,text="Product
description",font=('Arial',20),bg='white')

description.place(x=300,y=350)

description_entry=Text(wins,width=20,height=4,bg="#eee",font=('Arial',1
5))
description_entry.place(x=300,y=400)

P_Manufacturer=Label(wins,text="Manufacturer",font=('Arial',20),bg='whi
te')

P_Manufacturer.place(x=50,y=350)

P_Manufacturer_entry=Entry(wins,font=('Arial',20),bg='#eee',width=10)

P_Manufacturer_entry.place(x=50,y=400)

price=Label(wins,text="Price",font=('Arial',20),bg='white')

price.place(x=50,y=500)

price_entry=Entry(wins,font=('Arial',20),bg='#eee',width=5)

price_entry.place(x=50,y=550)

cart=Label(wins,text="Your Cart",font=('Arial',20),bg='white')

cart.place(x=575,y=50)

cart_entry=Text(wins,width=15,height=8,bg="#eee",font=('Arial',15))

cart_entry.place(x=575,y=100)

total_price=Label(wins,text="Total Price",font=('Arial',20),bg='white')

total_price.place(x=575,y=350)

total_price_entry=Entry(wins,font=('Arial',20),bg='#eee',width=5)

total_price_entry.place(x=575,y=400)

customer=Label(wins,text="Customer",font=('Arial',20),bg='white')
customer.place(x=575,y=450)

customer_entry=Entry(wins,font=('Arial',15),bg='#eee',width=15)

customer_entry.place(x=575,y=500)

date=Label(wins,text="Date",font=('Arial',20),bg='white')

date.place(x=300,y=500)

date_entry=Entry(wins,font=('Arial',20),bg='#eee',width=10)

date_entry.place(x=300,y=545)

def mysqll():

sql_Que = "select Product_name from shopping_mall where


Product_Name = '%s'"% P_list_entry.get()

curs = connection.cursor()

curs.execute(sql_Que)

reco = curs.fetchall()

name_entry.insert(tk.END,reco)

sql_Qu = "select quantity from shopping_mall where Product_Name


= '%s'"% P_list_entry.get()

cur = connection.cursor()

cur.execute(sql_Qu)

rec = cur.fetchall()

quantity_entry.insert(tk.END,rec)

sql_Q = "select Product_Description from shopping_mall where


Product_Name = '%s'"% P_list_entry.get()
cu = connection.cursor()

cu.execute(sql_Q)

re = str(cu.fetchall())

description_entry.insert(tk.END,re)

sql = "select manufacturer from shopping_mall where


Product_Name = '%s'"% P_list_entry.get()

c = connection.cursor()

c.execute(sql)

recore = c.fetchall()

P_Manufacturer_entry.insert(tk.END,recore)

sq = "select Price from shopping_mall where Product_Name =


'%s'"% P_list_entry.get()

inm = connection.cursor()

inm.execute(sq)

recoree = inm.fetchall()

price_entry.insert(tk.END,recoree)

def t_price():

a=cart_entry.insert(tk.END,(name_entry.get(),"x",quantity_entry.get() ))

k=float(price_entry.get())*int(quantity_entry.get())

if (total_price_entry.get())=="":

total_price_entry.insert(0,"0.00")

y=float(total_price_entry.get())
U=eval("y+k")

total_price_entry.delete(0,tk.END)

total_price_entry.insert(tk.END,U)

else:

j=float(total_price_entry.get())

q=eval("j+k")

total_price_entry.delete(0,tk.END)

total_price_entry.insert(tk.END,q)

quantity_entry.delete(0,tk.END)

P_Manufacturer_entry.delete(0,tk.END)

name_entry.delete(0,tk.END)

price_entry.delete(0,tk.END)

description_entry.delete("1.0", "end")

def abc():

quantity_entry.delete(0,tk.END)

P_Manufacturer_entry.delete(0,tk.END)

name_entry.delete(0,tk.END)

price_entry.delete(0,tk.END)

description_entry.delete("1.0", "end")

clear=Button(wins,text='clear',font=('Arial',15),bg="light
blue",command=abc).place(x=150,y=500)

gos=Button(wins,text='click after entering product


list',font=('Arial',10),bg="light blue",command=mysqll).place(x=50,y=150)

probe=Button(wins,text='add to cart',font=('Arial',15),bg="light
blue",command=t_price).place(x=150,y=550)
def my():

my=mysql.connector.connect(host="localhost",

user="root",

password="good",

database="pavithra")

x=my.cursor()

query="INSERT INTO `Customer_billing`


VALUES(%s,%s,%s,%s,%s)"

my_dataa=(no_entry.get(),date_entry.get(),cart_entry.get("1.0",'end-
1c'),total_price_entry.get(),customer_entry.get())

x.execute(query,my_dataa) # insert data

query1="DELETE FROM SHOPPING_MALL"

x.execute(query1)

my.commit()

box.showinfo("showinfo", "Thank you for visiting us.",parent=wins)

wins.destroy()

buy=Button(wins,text="Buy now",font=('Arial',20),bg="light
blue",command=my).place(x=575,y=540)

def c_b():

window=Tk()

window.title("CUSTOMER BILLINGS")

window.geometry('950x600')

window.configure(bg='white')

def m_c():

query="select * from customer_billing"


connection = mysql.connector.connect(host="localhost",

user="root",

password="good",

database="pavithra")

my_conn = connection.cursor()

my_conn.execute(query)

e = Label(window,width=17,font=('Arial',14), text="CUSTOMER
NO.",borderwidth=2, anchor="w")

e.grid(row=0, column=0)

e = Label(window,width=17,font=('Arial',14),
text="DATE",borderwidth=2, anchor="w")

e.grid(row=0, column=1)

e = Label(window,width=17,font=('Arial',14), text="PRODUCT x
QTY",borderwidth=2, anchor="w")

e.grid(row=0, column=2)

e = Label(window,width=17,font=('Arial',14), text="TOTAL
PRICE",borderwidth=2, anchor="w")

e.grid(row=0, column=3)

e = Label(window,width=17,font=('Arial',14), text="CUSTOMER
NAME",borderwidth=2, anchor="w")

e.grid(row=0, column=4)

i=1

for customer_billing in my_conn:

for j in range(len(customer_billing)):

e = Entry(window, font=('Arial',14),width=17, fg='black')

e.grid(row=i, column=j)
a=e.insert(END, customer_billing[j])

i=i+1

title=Label(window,text="SUPER MALL",font=("Arial",30),bg="light
blue").place(x=350,y=400)

b=Button(window,text="SHOW CUSTOMER
DELAILS",font=("Arial",20),bg="light
blue",command=m_c).place(x=290,y=500)

window.mainloop()

def edf():

if ((u.get()) == 'python' and (p.get())=='1234'):

window=Tk()

window.title("Super mall")

window.geometry('800x550')

window.configure(bg='white')

title=Label(window,text="SUPER
MALL",font=("Arial",50),bg="white",fg="dark blue").place(x=200,y=20)

adds=Button(window,text='PRODUCT ADDITION',fg='dark
blue',font=('Arial',20),relief='raised',width=20,command=add)

adds.place(x=50,y=150)

delete=Button(window,text='DELETE PRODUCT',fg='dark
blue',font=('Arial',20),relief='raised',width=20,command=de)

delete.place(x=50,y=250)

billing=Button(window,text='CUSTOMER BILLING',fg='dark
blue',font=('Arial',20),relief='raised',width=20,command=c_b)

billing.place(x=450,y=150)

order=Button(window,text='PURCHASE ORDER',fg='dark
blue',font=('Arial',20),relief='raised',width=20,command=purchase_order)
order.place(x=450,y=250)

end=Button(window,text='QUIT APPLICATION',fg='dark
blue',font=('Arial',20),relief='raised',width=20,command=lambda:(w.destr
oy(),window.destroy()))

end.place(x=250,y=370)

window.mainloop()

else:

box.showinfo('info','Invalid Login')

img=ImageTk.PhotoImage(Image.open ("D:\\login.jpg"))

login=Button(w,font=('Arial',30),command=edf,image=img)

login.place(x=300,y=350)

w.mainloop()
OUTPUT FOR THE CODING
 Login page

 On clicking the login button after entering the correct username


and password, if the entered details are wrong a message box
is displayed.
 On clicking product addition button.

On clicking
add product
 On clicking Delete product  clicking delete.

 On clicking purchase order  “click after entering product” 


entering customer no. , date, customer name.

 On clicking “add to cart”.


 On clicking “Buy now”.
 On clicking “customer billing”  clicking “Show customers
details.

 On clicking “quit application” the login page and the super mall
page closes.
LIMITATIONS

 This management system cannot exist alone without the python


shell .
 The value of products added can also be added and deleted
directly from MySQL software leading to redundancy and false
data.
 The values of customer billings can also be added and deleted
directly from MySQL software leading to redundancy and false
data.
 The source code is freely available and easily modifiable
leading to weak security.
 This management system works only with the MySQL software
having the same password, database, tables.
 The values entered in the product addition with same product
names can be easily confused leading to error in entering the
values in the purchase order window.
BIBLIOGRAPHY

 https://stackoverflow.com/
 https://python-forum.io/
 https://www.plus2net.com/python/tkinter-mysql.php
 https://www.tutorialspoint.com/python
 https://riptutorial.com/
 https://www.geeksforgeeks.org/python
 INFORMATICS PRACTICES TEXTBOOK CLASS XII
 INFORMATICS PRACTICES SUMITA ARORA REFERENCE
BOOK CLASS XII

You might also like