Informatics Practices Project
Informatics Practices Project
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
Tk GUI toolkit.
import mysql.connector
w=Tk()
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.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_price_entry.insert(tk.END,"50.00")
Manufacturer_entry.insert(tk.END,"Cadbury")
elif P_name_entry.get()=='Amul_Taaza_Milk':
P_price_entry.insert(tk.END,"25.00")
Manufacturer_entry.insert(tk.END,"Amul")
elif P_name_entry.get()=='Aashirvaad_Atta':
P_price_entry.insert(tk.END,"75.00")
Manufacturer_entry.insert(tk.END,"ITC")
elif P_name_entry.get()=='Parachute_Oil':
Manufacturer_entry.insert(tk.END,"Marico")
elif P_name_entry.get()=='Hide_and_Seek':
P_price_entry.insert(tk.END,"30.00")
Manufacturer_entry.insert(tk.END,"Parle")
elif P_name_entry.get()=='Cadbury_Oreo':
P_price_entry.insert(tk.END,"10.00")
Manufacturer_entry.insert(tk.END,"Cadbury")
elif P_name_entry.get()=='Waffy_Rolls_Tin':
P_price_entry.insert(tk.END,"100.00")
Manufacturer_entry.insert(tk.END,"Dukes")
elif P_name_entry.get()=='Fortune_Oil':
P_price_entry.insert(tk.END,"86.00")
Manufacturer_entry.insert(tk.END,"Adani")
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()
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'))
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():
cursor = connection.cursor()
cursor.execute(sql_Query)
connection.commit()
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")
cursor = connection.cursor()
cursor.execute(sql_Query)
record = cursor.fetchall()
Tup1 = ()
P_List=Label(wins,text="Product list",font=('Arial',20),bg='white')
P_List.place(x=50,y=50)
qs= tk.StringVar()
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():
curs = connection.cursor()
curs.execute(sql_Que)
reco = curs.fetchall()
name_entry.insert(tk.END,reco)
cur = connection.cursor()
cur.execute(sql_Qu)
rec = cur.fetchall()
quantity_entry.insert(tk.END,rec)
cu.execute(sql_Q)
re = str(cu.fetchall())
description_entry.insert(tk.END,re)
c = connection.cursor()
c.execute(sql)
recore = c.fetchall()
P_Manufacturer_entry.insert(tk.END,recore)
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)
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()
my_dataa=(no_entry.get(),date_entry.get(),cart_entry.get("1.0",'end-
1c'),total_price_entry.get(),customer_entry.get())
x.execute(query1)
my.commit()
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():
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 j in range(len(customer_billing)):
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():
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
add product
On clicking Delete product clicking delete.
On clicking “quit application” the login page and the super mall
page closes.
LIMITATIONS
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