Download as pdf or txt
Download as pdf or txt
You are on page 1of 82

Grocetaria Only the fresh, eat the best !

Project Work By
Avikshith S
Gorav Jhabakh
Sanjeev A

1
Grocetaria
Only the best, eat the fresh!
VIDYA MANDIR
MYLAPORE, CHENNAI - 600004

COMPUTER SCIENCE PROJECT

Regd. No : ________________

Certified Bona-fide Record of Project work done by ________________________


during the year 2021 - 2022

Date : 23-2-2022
Teacher – in – charge

Submitted for the Practical Examination held at VIDYA MANDIR Centre,


Chennai on _____________

External Examiner
2
Grocetaria
Only the best, eat the fresh!
CONTENTS

1. Acknowledgement……………………………………….4
2. Synopsis……………………………………………………….5
3. Salient Features……………………………………………6
4. Program Analysis………………………………………….8
5. Program Output And Code……………………….…11
6. Bibliography………………………………………………..82

3
Grocetaria
Only the best, eat the fresh!
ACKNOWLEDGEMENT

Our kind gratitude and gestures to our Computer


Science teachers
Ms. Harifa Begum
And
Ms. Nirmala Devi,
for the patience and belief in us to complete this
project successfully. Their valuable inputs and
advice have enabled us to make this program
efficient and user friendly.
We would also like to thank our friends and family
for all the encouragement and support that they
have given us.

4
Grocetaria
Only the best, eat the fresh!
SYNOPSIS
WHAT IS GROCETARIA ?

Grocetaria is an E-Commerce platform developed, to ease the use and


purchase of the highly demanding groceries. Grocetaria is an application that
has been developed purely using modules of Python.

WHY GROCETARIA ?

The demand for groceries is increasing day by day. During the COVID-19
Pandemic, many countries were subjected to Lockdowns due to the rise in
cases due to COVID-19. Groceries were highly in demand and went into the
hands of the greedy, than the needy. Grocetaria will help everyone with
appropriate groceries in a highly discounted price.

GROCETARIA : MODULES AND PACKAGES

1. Software(s):
• Python Version 3.9.0
• MySQL Version 8.0
2. Modules:
• tkinter - GUI
• pickle - Login / Register
• pymysql - creating data base
• CSV - temporary database
• subprocess - Switch to new files
• sys - Exit Current file
• tkvideo - ad-video and end video
• messagebox - Errors and Information
• Time - Generate delivery data
5
Grocetaria
Only the best, eat the fresh!
SALIENT FEATURES
• Grocetaria is an E-Commerce platform to initiate buying fresh groceries
direct from home.

• It opens with a start screen along with a Pop-up Advertisement


enhancing the feel of the software. It offers 4 sets of options namely,
‘User Login’, ‘User Register’, ‘ADMIN Login’, and ‘Exit’. Clicking on those
buttons redirects us to the appropriate screens.

• User Register can register a specific Email ID to access Grocetaria. Once


the Registration is done, it redirects to the login screen where only
registered users can login and proceed.

• ADMIN Login is a sophisticated process where only authorized users


working with the skeleton of Grocetaria, can Login and make changes to
our vast database.

• The ADMIN Center provides with 3 options namely, ‘Add Items’, ‘Delete
Items’, and ‘Modify Cost’. These options can allow only the
administrator to work and modify the database.

• After the user has successfully logged in, a main screen pops up
featuring a few floating banner buttons which redirects directly to the
offer site.

• The Screen has many options, namely, ‘Categories’, ‘My Profile’, ‘My
Cart’ and ‘Contact Us’. Categories will let us choose the category from
which the user would like to purchase. There are more than 10
predefined categories.

• A user can choose a category which takes him/her to the Category page
where he/she can choose products, add more than one quantity, and
add them to cart.

6
Grocetaria
Only the best, eat the fresh!
• My Cart is a separate GUI where a user can empty cart, review their
products, check their total amount, and proceed.

• Credentials is a separate section where the user must input his/her data
to proceed. All Data are stored separately with a lot of check conditions.

• Payment Merchant screen is the next screen following Credentials. This


screen offers a variety of payment options, which a user can select and
continue to pay and proceed.

• Once Payment has been initiated, the order will be successfully placed
and a Thank you page will pop up, with a predefined Pop-Up message. A
user can choose to download his/her data from an option below and
save it for future uses.

These are the Salient Features of Grocetaria


Only the fresh, eat the best !

7
Grocetaria
Only the best, eat the fresh!
PROJECT ANALYSIS
Grocetaria, has many GUI screens, upon which the main logics are explained
below,
• Database: The products of Grocetaria and its details are stored in a csv
file which is transferred to the database using csv and mysql.connector
modules. They also can be viewed and reviewed using MySQL.

• Welcome Screen: In the welcome screen, a top level function has been
used to pop up an advertisement for about 80 seconds. The screen
automatically closes using the destroy function. It features an
advertisement label, along with 4 buttons that redirect to the specific
files. This has been done using subprocess and sys functions.

• Login Screen: In the login screen, a registered user is able to login using
email and password. Both email and password are accepted using entry
widgets and when login button is pressed it directs to the main screen of
the app. The Email and password are accessed using a binary file in which
data was stored in the register section. If a user forgot his password then
the suer can change it by clicking on the forgot password button. If the
user does not have an account the user can go to register screen using
the register button.

• Register Screen :In the register screen, six entry boxes are given to get
the information about user details and a checkbox is given to accept the
terms and conditions. Checking conditions are defined for every entry
box to ensure quality of user data. After registering the information is
stored in a binary file as a dictionary with Email ID as a key, and the First
Name, Last Name, Mobile Number and password , in a list, as a value,
after which the user is directed to login page.

• Admin Login: Two entry boxes call admin email and password are
present through which an admin can enter email and password. Only
authorized and defined users can login. After login admin is directed to
admin page
8
Grocetaria
Only the best, eat the fresh!
• Admin Screen: admin can add/modify/delete a record from the
database using admin screen. Three buttons are given for the same.

• Admin Add: Admin can enter items code, item name, category, price for
the product and add into the database present in MySQL.

• Admin Modify: Admin can modify the cost of items, and which is
updated in the database.

• Main Screen : Mainscreen offers many buttons, where the first button,
‘Categories’, introduces a dropdown menu which has Grocetaria’s
predefined categories, and clicking on any of them would redirect them
to the specific category file. This has been done using subprocess and sys
modules. Contact Us is a messagebox which pops up on clicking and
displays information regarding the same.

• My Profile: User can view their full name, gmail, phone number and
password in the my profile section. They are taken from ‘trial.dat’ and
the values of the dictionary are displayed here.

• Categories: After selecting the category of user’s choice the category


page opens and a list of products are visible. Quantity is accepted from
the user and is added to cart. After adding items the user can click the
cart button to go to the cart page.

• Cart Page: Item name, rate, quantity and total amount is listed on the
screen. Total amount of listed at the bottom with proceed button. The
user can empty the cart or proceed to enter credentials.

• Credentials : Credentials screen is a GUI section which has numerous


entry boxes, to input the data from the user. There are checking
conditions for each entry box defined in the ‘Proceed’ Button, and will
only move to the next section if these checks are satisfied.

9
Grocetaria
Only the best, eat the fresh!
• Payments :Payment Window is a sophisticated system to bring in various
payment methods into Grocetaria. It shows a drop-down menu with the
available pay options, and a new frame opens. Once the option has been
selected. Each frame has specific checking conditions depending on the
mode of pay. Webbroswer module has been imported to bring in the
concept of online (network) redirection for net-banking. Other pay
options only have Entry widget checking conditions. Messagebox has
been imported from TKinter to display error messages.

• Order Placed :
In this GUI, a random Order ID and the expected data of delivery will be
generated using the random module. All this will be stored in a (.dat)
file which a user can access to get his/her order data.

10
Grocetaria
Only the best, eat the fresh!
PROGRAM CODES
WELCOME SCREEN :-

Code

from tkinter import *


from tkinter import ttk
import subprocess,sys
from tkvideo import tkvideo

def login():
subprocess.Popen(['Python','login.py'])
sys.exit(0)

def register():
subprocess.Popen(['Python','register.py'])
sys.exit(0)

def admin():
11
Grocetaria
Only the best, eat the fresh!
subprocess.Popen(['Python','adlogin.py'])
sys.exit(0)

def exit():
sp.destroy()

sp=Tk()
sp.title("Welcome To Grocetaria ! India's Fastest
Delivering Grocery Shop !")
sp.geometry('880x495')
sp.resizable(False, False)
iconimg=PhotoImage(file='logo.png')
sp.iconphoto(False,iconimg)

bg_img=PhotoImage(file='mainscreenlogo.png')
lb=Label(sp,image=bg_img)
lb.place(x=0,y=0)

frame=Frame(sp,width=850,height=350,bg='white')
frame.place(x=15,y=127)

ad_img=PhotoImage(file='main_ad.png')
piclabel=Label(frame, image=ad_img).place(x=170,y=15)

Button1=Button(frame, text='User Login',fg='white',


font=('calibri', 14,'bold'),width=20, bg='dark
green', command=login)
Button2=Button(frame, text='User
Register',fg='white', font=('calibri',
14,'bold'),width=20, bg='dark green',
command=register)
Button3=Button(frame, text='ADMIN Login',fg='white',
font=('calibri', 14,'bold'), width=20,bg='dark
green', command=admin)
Button4=Button(frame, text='Exit',fg='white',
font=('calibri', 14,'bold'),width=20,bg='dark green',
command=exit)

Button1.place(x=515, y=50)
12
Grocetaria
Only the best, eat the fresh!
Button2.place(x=515, y=100)
Button3.place(x=515, y=150)
Button4.place(x=515, y=200)

def ad():
def destroy_widget():
top.destroy()

top = Toplevel()
top.title('Welcome To Grocetaria :
Advertisement')
top.resizable(False, False)
img=PhotoImage(file='logo.png')
top.iconphoto(False, img)
video_label = Label(top)
video_label.pack()
player = tkvideo("ad_video.mp4", video_label)
player.play()
top.after(73000, destroy_widget)
top.mainloop()

sp.after(2000, ad)
Button5=Button(frame, text='Play Ad
Again',fg='white',bg='dark green', font=('calibri',
10), command=ad)
Button5.place(x=20, y= 300)
sp.mainloop()

13
Grocetaria
Only the best, eat the fresh!
USER LOGIN SCREEN :-

Code
from tkinter import *
from tkinter import messagebox
import pickle
import random, subprocess, sys

def back_fn():
subprocess.Popen(['Python','start.py'])
sys.exit(0)

def new_acc():
login.destroy()
import register

def for_pwd():
login.destroy()
import forgot

login=Tk()
14
Grocetaria
Only the best, eat the fresh!
login.title('Grocetaria : Login')
login.geometry('880x495')
login.resizable(False,False)
photo=PhotoImage(file='logo.png')
login.iconphoto(False, photo)
login.iconphoto(False, photo)

def cat():
subprocess.Popen(['Python','mainscreen.py'])
sys.exit(0)

def clear():
email_entry.delete(0,END)
pwd_entry.delete(0,END)

def login_func():
a=open('trial.dat','rb')
if email_entry.get()=='' or pwd_entry.get=='':
messagebox.showerror('Error !','Please enter
email or password')
else:
flag=True
opt=True
while flag:
try:
b=pickle.load(a)
except EOFError:
a.close()
flag=False
else:
ab={}
cd=ef=[]
for x,y in b.items():
if x==email_entry.get() and
y[3]==pwd_entry.get():
cd=cd+[x]
ef=ef+[y]
print(cd)
print(ef)
15
Grocetaria
Only the best, eat the fresh!
opt=True

if opt==True:
messagebox.showinfo('Success !','Login
Successful !')
clear()
abc=open('prof.dat','wb')

ab[cd[0]]=[ef[0][0],ef[0][1],ef[0][2],ef[0][3]]
print(ab)
pickle.dump(ab,abc)
abc.close()
cat()
else:
messagebox.showerror('Error','Invalid
Email or Password')
clear()

bg_image=PhotoImage(file='bg.png')
bg_label=Label(login,image=bg_image)
bg_label.place(x=0,y=0)

login_frame=Frame(login,width=400,height=400,bg='whit
e')
login_frame.place(x=230,y=45)

title_label=Label(login_frame,text='LOGIN',font=('Bah
nschrift',28,'bold'),bg='white',fg='black')
title_label.place(x=165,y=10)

email_label=Label(login_frame,text='Email
ID',bg='white',font=('Calibri',14,'bold'))
email_label.place(x=100,y=75)
password_label=Label(login_frame,text='Password',bg='
white',font=('Calibri',14,'bold'))
password_label.place(x=100,y=150)

email_entry=Entry(login_frame,font=('Calibri',14,'bol
d'))

16
Grocetaria
Only the best, eat the fresh!
pwd_entry=Entry(login_frame,font=('Calibri',14,'bold'
), show='*')
email_entry.place(x=100,y=100)
pwd_entry.place(x=100,y=175)

for_pwd_btn=Button(login_frame,text='Forgot Password
?',bg='white',font=('Calibri',9),fg='black',command=f
or_pwd)
for_pwd_btn.place(x=150,y=210)

login_btn_image=PhotoImage(file='log.png')
login_btn=Button(login_frame,image=login_btn_image,co
mmand=login_func)
login_btn.place(x=160,y=250)

new_acc_btn=Button(login_frame,text='Do not have an


account? Register Now
!',bg='white',font=('Calibri',10),fg='green',command=
new_acc)
new_acc_btn.place(x=80,y=300)

back_image=PhotoImage(file='back_btn.png')
back_btn=Button(login_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

login.mainloop()

17
Grocetaria
Only the best, eat the fresh!
FORGOT PASSWORD SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
from random import randint
import pickle

def rst(email):
captcha.destroy()
import reset
x=open('dummy.txt','w')
x.write(email)
x.close()

captcha=Tk()
captcha.title('Grocetaria : Verification')
captcha.geometry('600x450')
photo=PhotoImage(file='logo.png')
captcha.iconphoto(False, photo)
18
Grocetaria
Only the best, eat the fresh!
a=randint(0,100)
b=randint(0,100)
c=a+b
d=str(a)
e=str(b)

def clear():
email_entry.delete(0,END)
captcha_entry.delete(0,END)

def verify():
flag=True
a=open('trial.dat','rb')
while flag:
try:
b=pickle.load(a)
except EOFError:
a.close()
flag=False
else:
L=[]
for i in b.keys():
L=L+[i]
if email_entry.get() not in L:

messagebox.showerror('Error','Unregistered Email')
clear()
elif int(captcha_entry.get()) != c:
messagebox.showerror('Error','Invalid
answer')
clear()
else:
rst(email_entry.get())

bg_image=PhotoImage(file='bg.png')
bg_label=Label(captcha,image=bg_image)
bg_label.place(x=0,y=0)

19
Grocetaria
Only the best, eat the fresh!
captcha_frame=Frame(captcha,width=400,height=400,bg='
white')
captcha_frame.place(x=100,y=25)

title_label=Label(captcha_frame,text='VERIFICATION',f
ont=('Bahnschrift',28,'bold'),bg='white',fg='black')
title_label.place(x=100,y=10)

email_label=Label(captcha_frame,text='Email
ID',font=('Calibri',14,'bold'), bg='white')
email_label.place(x=100,y=90)
captcha_label=Label(captcha_frame,text=d+' + '+e+' =
? ',font=('Calibri',14,'bold'),bg='white')
captcha_label.place(x=100,y=165)

email_entry=Entry(captcha_frame,font=('Calibri',14,'b
old'))
captcha_entry=Entry(captcha_frame,font=('Calibri',14,
'bold'))
email_entry.place(x=100,y=115)
captcha_entry.place(x=100,y=190)

for_pwd_btn=Button(captcha_frame,text='Next',bg='whit
e',font=('Calibri',18),fg='black',command=verify)
for_pwd_btn.place(x=170,y=250)

captcha.mainloop()

20
Grocetaria
Only the best, eat the fresh!
RESET PASSWORD SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import pickle, subprocess, sys
import os

def dstry():
reset.destroy()
import login

def back_fn():
subprocess.Popen(['Python','start.py'])
sys.exit(0)

reset=Tk()
reset.title('Grocetaria : Reset Password')

21
Grocetaria
Only the best, eat the fresh!
reset.resizable(False,False)
reset.geometry('600x450')
photo=PhotoImage(file='logo.png')
reset.iconphoto(False, photo)

def clear():
pwd_entry.delete(0,END)
new_pwd_entry.delete(0,END)

def rst_pwd(email,pwd):
a=open('trial.dat','rb')
b=open('dummy.dat','wb')
flag=True
while flag:
try:
c=pickle.load(f)
except EOFError:
a.close()
b.close()
flag=False
else:
for x,y in c.items():
d={}
if x != email:
d[email]=y
pickle.dump(d,b)
else:
y[3]=pwd
d[email]=y
pickle.dump(d,b)
os.remove('trial.dat')
os.rename('dummy.dat','trial.dat')
messagebox.showinfo('Success','Password
reseted successfully')
dstry()

def b2login():
flag=True
a=open('trial.dat','rb')
while flag:
22
Grocetaria
Only the best, eat the fresh!
try:
b=pickle.load(a)
except EOFError:
a.close()
flag=False
else:
L=[]
for x in b.keys():
L=L+[x]
if pwd_entry.get() !=
new_pwd_entry.get():

messagebox.showerror('Error','Password Mismatch')
clear()
else:
y=open('dummy.txt','r')
z=str(y.readline())
y.close()
rst_pwd(z,pwd_entry.get())

bg_image=PhotoImage(file='bg.png')
bg_label=Label(reset,image=bg_image)
bg_label.place(x=0,y=0)

reset_frame=Frame(reset,width=400,height=400,bg='whit
e')
reset_frame.place(x=100,y=25)

title_label=Label(reset_frame,text='RESET
PASSWORD',font=('Bahnschrift',28,'bold'),bg='white',f
g='black')
title_label.place(x=45,y=10)

back_image=PhotoImage(file='back_btn.png')
back_btn=Button(reset_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

23
Grocetaria
Only the best, eat the fresh!
pwd_label=Label(reset_frame,text='New
Password',bg='white',font=('Calibri',14,'bold'))
pwd_label.place(x=140,y=105)
new_pwd_label=Label(reset_frame,text='Confirm
Password',bg='white',font=('Calibri',14,'bold'))
new_pwd_label.place(x=120,y=185)

pwd_entry=Entry(reset_frame,font=('Calibri',14,'bold'
))
new_pwd_entry=Entry(reset_frame,font=('Calibri',14,'b
old'))
pwd_entry.place(x=100,y=135)
new_pwd_entry.place(x=100,y=215)

for_pwd_btn=Button(reset_frame,text='Reset
Password',bg='white',font=('Calibri',14),fg='black',c
ommand=b2login)
for_pwd_btn.place(x=130,y=260)

reset.mainloop()

24
Grocetaria
Only the best, eat the fresh!
USER REGISTER SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import pickle, subprocess, sys

def back_fn():
subprocess.Popen(['Python','start.py'])
sys.exit(0)

def login1():
register.destroy()
import login

register=Tk()

25
Grocetaria
Only the best, eat the fresh!
register.title('Grocetaria : Register')
register.geometry('750x720+50+35')
register.resizable(False,False)
photo=PhotoImage(file='logo.png')
register.iconphoto(False, photo)
def login2():
import subprocess,sys
subprocess.Popen(['Python','adlogin.py'])
sys.exit(0)

def clear():
first_name_entry.delete(0,END)
last_name_entry.delete(0,END)
email_entry.delete(0,END)
ph_no_entry.delete(0,END)
pwd_entry.delete(0,END)
confirm_pwd_entry.delete(0,END)
def admin():
if email_entry.get()[-1:-11:-1] not in [
'moc.liamg@','','moc.kooltuo']:
messagebox.showerror('Error !','Enter valid
email')
elif len(ph_no_entry.get()) != 10:
messagebox.showerror('Error !','Enter valid
phone number')
elif first_name_entry.get()=='' or
last_name_entry.get()=='' or email_entry.get()=='' or
ph_no_entry.get()=='' or pwd_entry.get()=='' or
confirm_pwd_entry.get()=='':
messagebox.showerror('Error !','Please fill
all the fields!')
elif pwd_entry.get() != confirm_pwd_entry.get():
messagebox.showerror('Error !','Password
Mismatch!')
elif check_btn_val.get()==0:
messagebox.showerror('Error !','Please accept
our Terms And Conditions!')
else:
a=open("trial.dat","wb")
26
Grocetaria
Only the best, eat the fresh!
d={}
key=True
flag=True
while flag:
try:
m=pickle.load(a)
except:
a.close()
flag=False
else:
if email_entry.get() in m.keys():

messagebox.showerror('ERROR',"User Already Exists")


key=False
if(key==True):
a=open("trial.dat","ab")

d[email_entry.get()]=[first_name_entry.get(),last_nam
e_entry.get(),ph_no_entry.get(),pwd_entry.get()]
pickle.dump(d,a)
a.close()
messagebox.showinfo('ADMIN LOGIN
SUCCESSFUL')
clear()

def register_func():
if email_entry.get()[-1:-11:-1] not in [
'moc.liamg@','','moc.kooltuo']:
messagebox.showerror('Error !','Enter valid
email')
elif len(ph_no_entry.get()) != 10:
messagebox.showerror('Error !','Enter valid
phone number')
elif first_name_entry.get()=='' or
last_name_entry.get()=='' or email_entry.get()=='' or
ph_no_entry.get()=='' or pwd_entry.get()=='' or
confirm_pwd_entry.get()=='':
messagebox.showerror('Error !','Please fill
all the fields!')
27
Grocetaria
Only the best, eat the fresh!
elif pwd_entry.get() != confirm_pwd_entry.get():
messagebox.showerror('Error !','Password
Mismatch!')
elif check_btn_val.get()==0:
messagebox.showerror('Error !','Please accept
our Terms And Conditions!')
else:
a=open("trial.dat","wb")
d={}
key=True
flag=True
while flag:
try:
m=pickle.load(a)
except:
a.close()
flag=False
else:
if email_entry.get() in m.keys():

messagebox.showerror('ERROR',"User Already Exists")


key=False
if(key==True):
a=open("trial.dat","ab")

d[email_entry.get()]=[first_name_entry.get(),last_nam
e_entry.get(),ph_no_entry.get(),pwd_entry.get()]
pickle.dump(d,a)
a.close()
messagebox.showinfo('Success','Registered
Successfully')
clear()

bg_image=PhotoImage(file='bg.png')
bg_image.zoom(20)
bg_label=Label(register,image=bg_image, width=1000,
height=1000)
bg_label.place(x=0,y=0)
bg_2=Label(register,image=bg_image)
bg_2.place(x=0,y=0)
28
Grocetaria
Only the best, eat the fresh!
register_frame=Frame(register,width=650,height=620,bg
='white')
register_frame.place(x=50,y=35)

title_label=Label(register_frame,text='REGISTER',font
=('Bahnschrift',28,'bold'),bg='white',fg='black')
title_label.place(x=250,y=10)

first_name_label=Label(register_frame,text='First
Name',bg='white',font=('Calibri',14,'bold'))
last_name_label=Label(register_frame,text='Last
Name',bg='white',font=('Calibri',14,'bold'))
email_label=Label(register_frame,text='Email
ID',bg='white',font=('Calibri',14,'bold'))
ph_no_label=Label(register_frame,text='Contact
Number',bg='white',font=('Calibri',14,'bold'))
pwd_label=Label(register_frame,text='Password',bg='wh
ite',font=('Calibri',14,'bold'))
confirm_pwd_label=Label(register_frame,text='Confirm
Password',bg='white',font=('Calibri',14,'bold'))

first_name_label.place(x=75,y=100)
last_name_label.place(x=400,y=100)
email_label.place(x=75,y=225)
ph_no_label.place(x=400,y=225)
pwd_label.place(x=75,y=350)
confirm_pwd_label.place(x=400,y=350)

check_btn_val=IntVar()

first_name_entry=Entry(register_frame,font=('Calibri'
,14,'bold'))
last_name_entry=Entry(register_frame,font=('Calibri',
14,'bold'))
email_entry=Entry(register_frame,font=('Calibri',14,'
bold'))
ph_no_entry=Entry(register_frame,font=('Calibri',14,'
bold'))

29
Grocetaria
Only the best, eat the fresh!
pwd_entry=Entry(register_frame,font=('Calibri',14,'bo
ld'))
confirm_pwd_entry=Entry(register_frame,font=('Calibri
',14,'bold'))

first_name_entry.place(x=75,y=125)
last_name_entry.place(x=400,y=125)
email_entry.place(x=75,y=250)
ph_no_entry.place(x=400,y=250)
pwd_entry.place(x=75,y=375)
confirm_pwd_entry.place(x=400,y=375)

check_btn=Checkbutton(register_frame,text='I agree to
the Terms And
Conditions',cursor='hand2',onvalue=1,offvalue=0,varia
ble=check_btn_val,font=('Calibri',11))
check_btn.place(x=220,y=450)

register_btn_image=PhotoImage(file='register.png')

register_btn=Button(register_frame,image=register_btn
_image,command=admin)
register_btn.place(x=250,y=500)
login1=Button(register_frame,text=' Already a member?
Sign In
',bg='white',font=('Calibri',9),fg='blue',command=log
in1)
login1.place(x=247,y=560)

back_image=PhotoImage(file='back_btn.png')
back_btn=Button(register_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

register.mainloop()

30
Grocetaria
Only the best, eat the fresh!
MAINSCREEN :-

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import mysql.connector
import sys
import subprocess

def profile():
main_screen.destroy()
import prof
#subprocess.Popen(['Python','prof.py'])
#sys.exit(0)

def cart():
subprocess.Popen(['Python','cart_page.py'])
sys.exit(0)

def signout_command():
31
Grocetaria
Only the best, eat the fresh!
messagebox.showinfo('Success','You have
successfully signed out !')
subprocess.Popen(['Python','login.py'])
sys.exit(0)

def Contact_Us():
main_screen.withdraw()
messagebox.showinfo('Contact Us','Mobile Number :
+91 12345 67890\nEmail :
support@grocetaria.co.in\nProject Email :
csprojectvm@gmail.com',)
main_screen.deiconify()

def destroy_widget(widget):
widget.destroy()

def selected(event):
i=clicked.get()
cat(i)

def cat(a):
file=str(a)+'.py'
subprocess.Popen(['Python',file])
sys.exit(0)

def banner_loop():
banner_btn1=Button(main_canvas,
image=banner5_pic)
banner_btn2=Button(main_canvas,
image=banner4_pic)
banner_btn3=Button(main_canvas,
image=banner3_pic)
banner_btn4=Button(main_canvas,
image=banner2_pic)
banner_btn5=Button(main_canvas,
image=banner1_pic)
banner_btn1.place(x=30, y=270)
banner_btn2.place(x=30, y=270)
banner_btn3.place(x=30, y=270)
banner_btn4.place(x=30, y=270)
32
Grocetaria
Only the best, eat the fresh!
banner_btn5.place(x=30, y=270)
main_canvas.after(3000,
destroy_widget,banner_btn5)
main_canvas.after(6000,
destroy_widget,banner_btn4)
main_canvas.after(9000,
destroy_widget,banner_btn3)
main_canvas.after(12000,
destroy_widget,banner_btn2)
main_canvas.after(15000,banner_loop)

main_screen=Tk()
main_screen.resizable(False,False)
main_screen.title('Grocetaria')
main_screen.geometry('880x495')
photo=PhotoImage(file='logo.png')
main_screen.iconphoto(False,photo)

main_frame=Frame(main_screen)
main_frame.pack(fill=BOTH,expand=1)
main_canvas=Canvas(main_frame)
main_canvas.pack(side=LEFT,fill=BOTH,expand=1)
scroll=ttk.Scrollbar(main_frame,orient=VERTICAL,comma
nd=main_canvas.yview)
scroll.pack(side=RIGHT,fill=Y)
main_canvas.configure(yscrollcommand=scroll.set)
main_canvas.bind('<Configure>',lambda e:
main_canvas.configure(scrollregion=main_canvas.bbox('
all')))
second_frame=Frame(main_canvas)
main_canvas.create_window((0,0),window=second_frame,a
nchor='nw')

photo1=PhotoImage(file='mainscreenlogo.png')
label1=Label(main_canvas,image=photo1)
label1.place(x=0,y=0)
label2=Label(main_canvas, text='Welcome User,',
font=('aharoni', 12, 'bold'), fg='dark green')
label2.place(x=30,y=115)

33
Grocetaria
Only the best, eat the fresh!
search_entry=Entry(main_canvas,font=('Calibri',13,'bo
ld'),width=75)
search_entry.place(x=60,y=150)
search_image=PhotoImage(file='searchbtn.png')
search_btn=Button(main_canvas,image=search_image)
search_btn.place(x=740,y=145)

clicked=StringVar()
clicked.set('Categories')
L=['Biscuits','Beverages','Canned
Food','Cereals','Flour and Refinery','Health
Mix','Miscellaneous
Items','Nuts','Pulses','Snacks','Spices','All
Products']
cat_drop=OptionMenu(main_canvas,clicked,*L,command=se
lected)
cat_drop.config(font=('Grandview
Displayi',12,'bold'),width=20, fg='white',bg='dark
green')
cat_drop.place(x=19,y=210)

lb1=Button(main_canvas,text='My
Profile',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=profile)
lb2=Button(main_canvas,text='Cart',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green', command=cart)
lb1.place(x=240,y=210)
lb2.place(x=450,y=210)

con_us_btn=Button(main_canvas,text='Contact
Us',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=Contact_Us)
con_us_btn.place(x=660,y=210)

banner1_pic=PhotoImage(file='banner1.png')
banner2_pic=PhotoImage(file='banner2.png')
banner3_pic=PhotoImage(file='banner3.png')
34
Grocetaria
Only the best, eat the fresh!
banner4_pic=PhotoImage(file='banner4.png')
banner5_pic=PhotoImage(file='banner5.png')

banner_loop()

sign_out=Button(main_canvas, text='Sign
Out',command=signout_command,font=('Grandview
Display',8,'bold'),fg='white',bg='dark green')
sign_out.place(x=400, y=450)

main_screen.mainloop()

35
Grocetaria
Only the best, eat the fresh!
CATEGORIES SCREEN :-
THIS IS A COMMON CODE FOR ALL DEFINED CATEGORIES AT GROCETARIA

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import mysql.connector
import pickle,subprocess,sys

bis={}
xyz=open('password.txt','r')
zxy=xyz.read()
xyz.close()
mydb=mysql.connector.connect(host='localhost',user='r
oot',password=zxy,database='csproject')
mycr=mydb.cursor()
36
Grocetaria
Only the best, eat the fresh!
mycr.execute('select * from projectdatabase;')
for i in mycr:
bis[i[0]]=[i[1],i[2],i[3]]

all_products=Tk()
all_products.resizable(False,False)
all_products.title('Grocetaria : All Products')
all_products.geometry('880x660+20+20')
photo=PhotoImage(file='logo.png')
all_products.iconphoto(False,photo)

def cart():
subprocess.Popen(['Python','cart_page.py'])
sys.exit(0)

def press(code,quantity):
k=[]
l=[]
for m,n in bis.items():
k=k+[m]
l=l+[n]
for i in k:
if k[code]==i:
j=bis[i]
quan=quantity.get()
quantity.set('')

f=open('cart.dat','ab')

L=[l[code][0],l[code][1],l[code][2],quan,quan*int(l[c
ode][1])]
pickle.dump(L,f)
f.close()
print(L)

def back_fn():
subprocess.Popen(['Python','mainscreen.py'])
sys.exit(0)

37
Grocetaria
Only the best, eat the fresh!
bg_img=PhotoImage(file='mainscreenlogo.png')
lb=Label(all_products,image=bg_img)
lb.place(x=0,y=0)

frame=Frame(all_products,width=820,height=450,bg='whi
te')
frame.place(x=15,y=130)
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)
biscuit_label=Label(frame,text='All
Products',font=('Calibri',31,'bold'),bg='white',width
=32,fg='dark green')
biscuit_label.place(x=65,y=5)
cart_img=PhotoImage(file='cart _btn.png')
cart_btn=Button(frame,image=cart_img,command=cart)
cart_btn.place(x=771,y=5)

canvas=Canvas(frame,height=435,width=820)
canvas.pack(side=LEFT,padx=(5,0),pady=(65,5),expand=T
rue)
scroll=ttk.Scrollbar(frame,orient=VERTICAL,command=ca
nvas.yview)
scroll.pack(side=RIGHT,fill=Y,padx=(0,5),pady=(65,5))
canvas.configure(yscrollcommand=scroll.set)
canvas.bind('<Configure>',lambda e:
canvas.configure(scrollregion=canvas.bbox('all')))
frame2=Frame(canvas,height=370,width=820)
canvas.create_window((0,0),window=frame2,anchor='nw')

A=[]
B=[]
C=[]
for x,y in bis.items():
A=A+[x]
B=B+[y]
C=C+[x+'_var']
for i in range(len(C)):
C[i]=IntVar()
38
Grocetaria
Only the best, eat the fresh!
C[i].set('')

a=len(A)
c=Label(frame2,text='Product
Name',font=('Calibri',16,'bold'),fg='dark green')
c.grid(row=0,column=0)
c=Label(frame2,text='Price
(₹)',font=('Calibri',16,'bold'),fg='dark green')
c.grid(row=0,column=1)
c=Label(frame2,text='Quantity',font=('Calibri',16,'bo
ld'),fg='dark green')
c.grid(row=0,column=2)

for i in range(a):

A[i]=Label(frame2,text=B[i][0],font=('Calibri',12,'bo
ld'),width=53,height=2,anchor='w', fg='dark green')
A[i].grid(row=i+1,column=0)

A[i]=Label(frame2,text=str(B[i][1]),font=('Calibri',1
2,'bold'),width=10,height=2,fg='dark green')
A[i].grid(row=i+1,column=1)

A[i]=Entry(frame2,font=('Calibri',12,'bold'),fg='dark
green',justify='center',textvariable=C[i])
A[i].grid(row=i+1,column=2)
A[i]=Label(frame2,text=' ')
A[i].grid(row=i+1,column=3)
A[i]=Button(frame2,text="Add To
Cart",font=('Calibri',12,'bold'),bg='dark green',
fg='white',width=10,command=lambda i=i:
press(i,C[i]))
A[i].grid(row=i+1,column=4)

all_products.mainloop()

39
Grocetaria
Only the best, eat the fresh!
CART SCREEN :-

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import subprocess,sys,pickle

def back_fn():
subprocess.Popen(['Python','mainscreen.py'])
sys.exit(0)

def empty_cart():
f=open('cart.dat', 'wb')
f.close()
subprocess.Popen(['Python','cart_page.py'])
sys.exit(0)

def proceed_command():
40
Grocetaria
Only the best, eat the fresh!
subprocess.Popen(['Python','credentials.py'])
sys.exit(0)

cartpage=Tk()
cartpage.resizable(False,False)
cartpage.title('Grocetaria : My Cart')
cartpage.geometry('880x660+20+20')
photo=PhotoImage(file='logo.png')
cartpage.iconphoto(False,photo)
cartpage.resizable(False,False)

bg_img=PhotoImage(file='mainscreenlogo.png')
lb=Label(cartpage,image=bg_img)
lb.place(x=0,y=0)

search_entry=Entry(cartpage,font=('Calibri',13,'bold'
),width=75)
search_entry.place(x=60,y=150)
search_image=PhotoImage(file='searchbtn.png')
search_btn=Button(cartpage,image=search_image)
search_btn.place(x=740,y=145)

frame=Frame(cartpage,width=820,height=400,bg='white')
frame.place(x=15,y=150)
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=5)
biscuit_label=Label(frame,text='My
Cart',font=('Calibri',31,'bold'),bg='white',width=32,
fg='dark green')
biscuit_label.place(x=65,y=5)

remove_cart=Button(frame, text='Empty Cart',


font=('Calibri', 16, 'bold'), fg='white', bg='dark
green', command=empty_cart)
remove_cart.place(x=700, y=5)

canvas=Canvas(frame,height=370,width=820)

41
Grocetaria
Only the best, eat the fresh!
canvas.pack(side=LEFT,padx=(5,0),pady=(65,5),expand=T
rue)
scroll=ttk.Scrollbar(frame,orient=VERTICAL,command=ca
nvas.yview)
scroll.pack(side=RIGHT,fill=Y,padx=(0,5),pady=(65,5))
canvas.configure(yscrollcommand=scroll.set)
canvas.bind('<Configure>',lambda e:
canvas.configure(scrollregion=canvas.bbox('all')))
frame2=Frame(canvas,height=768,width=1100)
canvas.create_window((0,0),window=frame2,anchor='nw')

c=Label(frame2,text='Product
Name',font=('Calibri',16,'bold'),fg='dark
green',width=35)
c.grid(row=0,column=0)
c=Label(frame2,text='Price
(₹)',font=('Calibri',16,'bold'),fg='dark
green',width=10)
c.grid(row=0,column=1)
c=Label(frame2,text='Quantity',font=('Calibri',16,'bo
ld'),fg='dark green',width=15)
c.grid(row=0,column=2)
c=Label(frame2,text='Amount
(₹)',font=('Calibri',16,'bold'),fg='dark
green',width=10)
c.grid(row=0,column=3)

L=[]
f=open('cart.dat','rb')
try :
while True :
reader=pickle.load(f)
L=L+[reader]
except EOFError :
pass
f.close()
a=len(L)

for i in range(a) :

42
Grocetaria
Only the best, eat the fresh!
A=Label(frame2,text=L[i][0],font=('Calibri',12,'bold'
),width=30,height=2,anchor='w',fg='dark green')

B=Label(frame2,text=L[i][1],font=('Calibri',12,'bold'
),width=10,height=2, fg='dark green')

C=Label(frame2,text=L[i][3],font=('Calibri',12,'bold'
),width=15,height=2, fg='dark green')

D=Label(frame2,text=L[i][4],font=('Calibri',12,'bold'
),width=10,height=2, fg='dark green')
A.grid(row=i+1,column=0)
B.grid(row=i+1,column=1)
C.grid(row=i+1, column=2)
D.grid(row=i+1,column=3)

tot_amount=0
for i in range(a):
tot_amount=tot_amount+L[i][4]
tot_amt=str(tot_amount)
tot_text='Total Cost : ₹'+tot_amt+'/---'

f=open('amount_data.dat', 'wb')
pickle.dump(tot_amt, f)
f.close()

tot=Label(cartpage,text=tot_text,font=('Calibri', 24,
), fg='dark green')
tot.place(x=200,y=603)

proceed=Button(cartpage, text='Proceed',
font=('Calibri', 16, 'bold'), fg='white', bg='dark
green', command=proceed_command)
proceed.place(x=550, y=603)

cartpage.mainloop()

43
Grocetaria
Only the best, eat the fresh!
CREDENTIALS SCREEN :-

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import random, string, mysql.connector, webbrowser,
time, pickle, subprocess, sys

def Contact_Us():
messagebox.showinfo('Contact Us','Mobile Number :
+91 12345 67890\nEmail :
support@grocetaria.co.in\nProject Email :
csprojectvm@gmail.com')

def Main_Page():
subprocess.Popen(['Python','mainscreen.py'])
sys.exit(0)

44
Grocetaria
Only the best, eat the fresh!
def cart():
subprocess.Popen(['Python','cart_page.py'])
sys.exit(0)

def proceed_command():
flag=True
final_address=ad1_entry.get()+',
'+ad2_entry.get()+', '+ad3_entry.get()

if name_entry.get() =='' :
messagebox.showinfo('Error !','Please enter a
valid Name')
flag=False
elif email_entry.get()=='' and
email_entry.get().endswith('@gmail.com')==False:
messagebox.showinfo('Error !','Please enter a
valid Email ID')
flag=False
elif mobile_entry.get().isdigit()==False and
len(mobile_entry.get()) != 10 :
messagebox.showinfo('Error !','Please enter a
valid Mobile Number')
flag=False
elif final_address == ', , ' :
messagebox.showinfo('Error !','Address cannot
be empty')
flag=False
elif state_entry.get().isalpha()==False and
state_entry.get()=='' :
messagebox.showinfo('Error !','Please enter a
valid State')
flag=False
elif city_entry.get().isalpha()==False and
city_entry.get()=='' :
messagebox.showinfo('Error !','Please enter a
valid City')
flag=False
elif pincode_entry.get().isdigit()==False and
len(pincode_entry.get()) !=6 :

45
Grocetaria
Only the best, eat the fresh!
messagebox.showinfo('Error !','Please enter a
valid Pin-Code')
flag=False
elif alt_entry.get()==mobile_entry.get() :
messagebox.showinfo('Error !',"Alternate
Number shouldn't be same as Mobile Number")
flag=False
elif alt_entry.get().isdigit()==False and
len(alt_entry.get()) != 10:
messagebox.showinfo('Error !','Please enter a
valid Mobile Number')
flag=False

if flag==True :
cred_dict={'name':name_entry.get(),
'email':email_entry.get(),'mobile':mobile_entry.get()
,'address':final_address,'city':city_entry.get(),'sta
te': state_entry.get(),'pincode':
pincode_entry.get(),'landmark':
land_entry.get(),'altno': alt_entry.get()}
f=open('cred_data.dat','wb')
pickle.dump(cred_dict,f)
f.close()
subprocess.Popen(['Python','payments.py'])
sys.exit(0)

def selected(event):
i=clicked.get()
cat(i)

def cat(a):
file=str(a)+'.py'
subprocess.Popen(['Python',file])
sys.exit(0)

main_screen=Tk()
main_screen.resizable(False,False)
main_screen.title('Grocetaria : Credentials')
main_screen.geometry('880x750+10+10')
photo=PhotoImage(file='logo.png')
46
Grocetaria
Only the best, eat the fresh!
main_screen.iconphoto(False,photo)

main_frame=Frame(main_screen)
main_frame.pack(fill=BOTH,expand=1)
main_canvas=Canvas(main_frame)
main_canvas.pack(side=LEFT,fill=BOTH,expand=1)
scroll=ttk.Scrollbar(main_frame,orient=VERTICAL,comma
nd=main_canvas.yview)
scroll.pack(side=RIGHT,fill=Y)
main_canvas.configure(yscrollcommand=scroll.set)
main_canvas.bind('<Configure>',lambda e:
main_canvas.configure(scrollregion=main_canvas.bbox('
all')))
second_frame=Frame(main_canvas)
main_canvas.create_window((0,0),window=second_frame,a
nchor='nw')

photo1=PhotoImage(file='mainscreenlogo.png')
label1=Button(main_canvas,image=photo1, command=
Main_Page)
label1.place(x=0,y=0)

clicked=StringVar()
clicked.set('Categories')
L=['Biscuits','Beverages','Canned
Food','Cereals','Flour and Refinery','Health
mix','Misc','Nuts','Pulses','Snacks','Spices','All
Products']
cat_drop=OptionMenu(main_canvas,clicked,*L,command=se
lected)
cat_drop.config(font=('Grandview
Displayi',12,'bold'),width=20, fg='white',bg='dark
green')
cat_drop.place(x=19,y=180)

lb1=Button(main_canvas,text='My
Profile',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')

47
Grocetaria
Only the best, eat the fresh!
lb2=Button(main_canvas,text='Cart',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=cart)
lb1.place(x=240,y=180)
lb2.place(x=450,y=180)

con_us_btn=Button(main_canvas,text='Contact
Us',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=Contact_Us)
con_us_btn.place(x=660,y=180)

order_msg=Label(main_canvas, text='Credentials',
font=('Grandview Display',17,'bold', 'underline'),
fg='dark green')
order_msg.place(x=380, y=230)

frame=Frame(main_canvas, width=830, height=450,


bg='white')
frame.place(x=15, y=275)
second_canvas=Canvas(frame, bg='white', width=820,
height=450)
second_canvas.pack(side=LEFT,fill=BOTH,expand=1)
scroll=ttk.Scrollbar(frame,orient=VERTICAL,command=se
cond_canvas.yview)
scroll.pack(side=RIGHT,fill=Y)
second_canvas.configure(yscrollcommand=scroll.set)
second_canvas.bind('<Configure>',lambda e:
second_canvas.configure(scrollregion=second_canvas.bb
ox('all')))
third_frame=Frame(second_canvas,width=820,
height=450, bg='white')
second_canvas.create_window((0,0),window=third_frame,
anchor='nw')

name_label=Label(third_frame, text='Name :
',font=('Grandview Display',14), fg='dark green',
bg='white')
name_label.place(x=20, y=20)

48
Grocetaria
Only the best, eat the fresh!
name_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
name_entry.place(x=200, y=20)

email_label=Label(third_frame, text='Email ID :
',font=('Grandview Display',14), fg='dark green',
bg='white')
email_label.place(x=20,y=50)
email_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
email_entry.place(x=200, y=50)

mobile_label=Label(third_frame, text='Mobile Number :


',font=('Grandview Display',14), fg='dark green',
bg='white')
mobile_label.place(x=20, y=80)
mobile_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
mobile_entry.place(x=200, y=80)

ad1_label=Label(third_frame, text='Address Line 1 :


',font=('Grandview Display',14), fg='dark green',
bg='white')
ad2_label=Label(third_frame, text='Address Line 2 :
',font=('Grandview Display',14), fg='dark green',
bg='white')
ad3_label=Label(third_frame, text='Address Line 3 :
',font=('Grandview Display',14), fg='dark green',
bg='white')
ad1_label.place(x=20, y=120)
ad2_label.place(x=20, y=150)
ad3_label.place(x=20, y=180)
ad1_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
ad2_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
ad3_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
ad1_entry.place(x=200, y=120)
ad2_entry.place(x=200, y=150)
49
Grocetaria
Only the best, eat the fresh!
ad3_entry.place(x=200, y=180)

city_label=Label(third_frame, text='City :
',font=('Grandview Display',14), fg='dark green',
bg='white')
state_label=Label(third_frame, text='State :
',font=('Grandview Display',14), fg='dark green',
bg='white')
pincode_label=Label(third_frame, text='Pin-Code :
',font=('Grandview Display',14), fg='dark green',
bg='white')
city_label.place(x=20, y=220)
state_label.place(x=20, y=250)
pincode_label.place(x=20, y=280)
city_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
state_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
pincode_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
city_entry.place(x=200, y=220)
state_entry.place(x=200, y=250)
pincode_entry.place(x=200, y=280)

land_label=Label(third_frame, text='Landmark :
',font=('Grandview Display',14), fg='dark green',
bg='white')
land_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
land_label.place(x=20, y=320)
land_entry.place(x=200,y=320)

alt_label=Label(third_frame, text='Alternative Ph.No


: ',font=('Grandview Display',14), fg='dark green',
bg='white')
alt_entry=Entry(third_frame, font=('Grandview
Display',12), fg='dark green', bg='white', width=50)
alt_label.place(x=20,y=350)
alt_entry.place(x=200, y=350)

50
Grocetaria
Only the best, eat the fresh!
proceed_btn=Button(third_frame,
text='Proceed',font=('Grandview Display',14),
fg='white', bg='dark green', command=proceed_command)
proceed_btn.place(x=390, y=370)
main_screen.mainloop()

51
Grocetaria
Only the best, eat the fresh!
PAYMENTS SCREEN :-

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import mysql.connector, webbrowser,
pickle,subprocess,sys

def open_next():
subprocess.Popen(['Python','order_placed.py'])
sys.exit(0)

def Contact_Us():
messagebox.showinfo('Contact Us','Mobile Number :
+91 12345 67890\nEmail :
support@grocetaria.co.in\nProject Email :
csprojectvm@gmail.com')

def Main_Page():
subprocess.Popen(['Python','mainscreen.py'])
sys.exit(0)

52
Grocetaria
Only the best, eat the fresh!
def selected(event):
i=clicked.get()
cat(i)

def cat(a):
file=str(a)+'.py'
subprocess.Popen(['Python',file])
sys.exit(0)

def proceed_command():
final_check=True
if name.get()=='Credit / Debit Cards':
if cardno_entry.get().isdigit()==True and
len(cardno_entry.get())==16:
final_check=True
else :
final_check=False
messagebox.showinfo('Error !','Invalid
Card Number ! Please enter a valid card number.')
cardno_entry.delete(0, END)

if expiry1_entry.get().isdigit()==True and
len(expiry1_entry.get())==2 and
int(expiry1_entry.get())>=1 and
int(expiry1_entry.get())<=12 :
final_check=True
else :
final_check=False
messagebox.showinfo('Error !','Invalid
Expiry Date ! Please enter a valid expiry date.')
expiry1_entry.delete(0, END)

if expiry2_entry.get().isdigit()==True and
len(expiry2_entry.get())==2 and
int(expiry2_entry.get())>=22 :
final_check=True
else :
final_check=False
messagebox.showinfo('Error !','Invalid
Expiry Date ! Please enter a valid expiry date.')
53
Grocetaria
Only the best, eat the fresh!
expiry2_entry.delete(0, END)

if cvv_entry.get().isdigit()==True and
len(cvv_entry.get())==3 :
final_check=True
else :
final_check=False
messagebox.showinfo('Error !','Invalid
CVV ! Please enter a valid CVV.')
cvv_entry.delete(0, END)

elif name.get()=='UPI' :
if upi_id.get().isdigit()==True and
len(upi_id.get())==6 :
final_check=True
else :
final_check=False
messagebox.showinfo('Error !','Invalid
UPI Pin ! Please enter a valid UPI ')
upi_id.delete(0, END)
elif name.get()=='Net Banking' :
final_check=True
elif name.get()=='Pay On Delivery' :
final_check=True

if final_check==True :
f=open('payment_data.dat', 'wb')
if name.get()=='Credit / Debit Cards':

expiry_final=expiry1_entry.get()+'/'+expiry2_entry.ge
t()
data_dict={'cardno':cardno_entry.get()
,'expirydate':expiry_final,'cvv':cvv_entry.get()}
pickle.dump(data_dict, f)
f.close()
open_next()

def payment_execute(event):

def netbanking_execute(event):
54
Grocetaria
Only the best, eat the fresh!
for widget in second_frame.winfo_children():
widget.destroy()
if var_dropdown.get()=='HDFC Bank' :

webbrowser.open('https://netbanking.hdfcbank.com/netb
anking/')
if var_dropdown.get()=='State Bank Of India'
:

webbrowser.open('https://retail.onlinesbi.com/retail/
login.htm')
if var_dropdown.get()=='Axis Bank':

webbrowser.open('https://retail.axisbank.co.in/wps/po
rtal/rBanking/axisebanking/AxisRetailLogin/!ut/p/a1/0
4_Sj9CPykssy0xPLMnMz0vMAfGjzOKNAzxMjIwNjLwsQp0MDBw9PU
Od3HwdDQwMjIEKIoEKDHAARwNC-
sP1o_ArMYIqwGNFQW6EQaajoiIAVNL82A!!/dl5/d5/L2dBISEvZ0
FBIS9nQSEh/')
if var_dropdown.get()=='Citi Bank':

webbrowser.open('https://www.online.citibank.co.in/')
if var_dropdown.get()=='Punjab National
Bank':

webbrowser.open('https://netbanking.netpnb.com/corp/A
uthenticationController?FORMSGROUP_ID__=Authenticatio
nFG&__START_TRAN_FLAG__=Y&__FG_BUTTONS__=LOAD&ACTION.
LOAD=Y&AuthenticationFG.LOGIN_FLAG=1&BANK_ID=024')

def upi_execute(event):
global upi_id
upi_id_label=Label(second_frame, text="UPI
Pin : ",font=('Caaa',12), fg='dark green')
upi_id_label.place(x=30, y=450)
upi_id=Entry(main_screen,
font=('Calibri',13,'bold'),width=30)
upi_id.place(x=100, y=450)

if name.get() in payment_choice :
55
Grocetaria
Only the best, eat the fresh!
if name.get() != 'Wallets' :
proceed_button=Button(main_screen,
text='Place Your Order',font=('Grandview
Display',16,'bold'), fg='white', bg='dark green',
command=proceed_command)
proceed_button.place(x=550, y= 430)

if name.get()=='UPI':
for widget in second_frame.winfo_children():
widget.destroy()
upi_var=StringVar()
upi_var.set('Choose UPI App')
upi_options=['PayTM','Amazon Pay','Google
Pay','PhonePe','BHIM UPI']
upi_menu=OptionMenu(second_frame, upi_var,
*upi_options, command=upi_execute)
upi_menu.config(font=('Grandview
Displayi',12,'bold'),width=40, fg='white',bg='dark
green')
upi_menu.place(x=50, y= 400)

if name.get()=='Credit / Debit Cards':


for widget in second_frame.winfo_children():
widget.destroy()
global cardno_entry, expiry1_entry,
expiry2_entry, cvv_entry
label_cardno=Label(second_frame, text='Enter
16 digit card number : ', font=('Caaa',12), fg='dark
green')
label_cardno.place(x=20, y=400)

cardno_entry=Entry(second_frame,font=('Calibri',13,'b
old'),width=60)
cardno_entry.place(x=240, y= 400)
label_expiry=Label(second_frame, text='Expiry
Date (mm/yyyy) : ', font=('Caaa',12), fg='dark
green')
label_expiry.place(x=20, y=430)
label_slash=Label(second_frame, text='/',
font=('Caaa',25), fg='dark green')
56
Grocetaria
Only the best, eat the fresh!
label_slash.place(x=242,y=420)

expiry1_entry=Entry(second_frame,font=('Calibri',13,'
bold'),width=4)

expiry2_entry=Entry(second_frame,font=('Calibri',13,'
bold'),width=10)
expiry1_entry.place(x= 200, y=430)
expiry2_entry.place(x=260, y=430)
label_cvv=Label(second_frame, text='CVV
Number : ', font=('Caaa',12), fg='dark green')
label_cvv.place(x=20, y=460)
cvv_entry=
Entry(second_frame,font=('Calibri',13,'bold'),width=1
7)
cvv_entry.place(x=200, y=460)

if name.get()=='Net Banking':
for widget in second_frame.winfo_children():
widget.destroy()
var_dropdown=StringVar()
var_dropdown.set('Choose from the Available
Banks')
Bank_options=['HDFC Bank', 'State Bank Of
India', 'Axis Bank', 'Citi Bank', 'Punjab National
Bank']
netbanking_menu=OptionMenu(second_frame,
var_dropdown, *Bank_options,
command=netbanking_execute)
netbanking_menu.config(font=('Grandview
Displayi',12,'bold'),width=40, fg='white',bg='dark
green')
netbanking_menu.place(x=50, y= 400)

if name.get()=='Wallets':
for widget in second_frame.winfo_children():
widget.destroy()
wallet_label=Label(second_frame,text='Sorry
for the inconvenience !\nWallet support is currently
57
Grocetaria
Only the best, eat the fresh!
not available. \n Please consider leaving your
feedback in the Contact Us Section',
font=('Caaa',12), fg='dark green')
wallet_label.place(x=30, y= 400)

if name.get()=='Pay On Delivery':
for widget in second_frame.winfo_children():
widget.destroy()
abc=Label(second_frame,text="Cash to be paid
on delivery",font=('Grandview
Display',14,'bold'),bg='dark green',fg='white')
abc.place(x=50,y=420)

main_screen=Tk()
main_screen.resizable(False,False)
main_screen.title('Grocetaria : Payment Window')
main_screen.geometry('880x515')
photo=PhotoImage(file='logo.png')
main_screen.iconphoto(False,photo)

main_frame=Frame(main_screen)
main_frame.pack(fill=BOTH,expand=1)
main_canvas=Canvas(main_frame)
main_canvas.pack(side=LEFT,fill=BOTH,expand=1)
scroll=ttk.Scrollbar(main_frame,orient=VERTICAL,comma
nd=main_canvas.yview)
scroll.pack(side=RIGHT,fill=Y)
main_canvas.configure(yscrollcommand=scroll.set)
main_canvas.bind('<Configure>',lambda e:
main_canvas.configure(scrollregion=main_canvas.bbox('
all')))
second_frame=Frame(main_canvas,width=860,height=510)
main_canvas.create_window((0,0),window=second_frame,a
nchor='nw')

photo1=PhotoImage(file='mainscreenlogo.png')
label1=Button(main_canvas,image=photo1, command=
Main_Page)
label1.place(x=0,y=0)

58
Grocetaria
Only the best, eat the fresh!
search_entry=Entry(main_canvas,font=('Calibri',13,'bo
ld'),width=75)
search_entry.place(x=60,y=150)
search_image=PhotoImage(file='searchbtn.png')
search_btn=Button(main_canvas,image=search_image)
search_btn.place(x=740,y=145)

clicked=StringVar()
clicked.set('Categories')
L=['Biscuits','Beverages','Canned
Food','Cereals','Flour and Refinery','Health
mix','Misc','Nuts','Pulses','Snacks','Spices','All
Products']
cat_drop=OptionMenu(main_canvas,clicked,*L,command=se
lected)
cat_drop.config(font=('Grandview
Displayi',12,'bold'),width=20, fg='white',bg='dark
green')
cat_drop.place(x=19,y=210)

lb1=Button(main_canvas,text='My
Profile',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')
lb2=Button(main_canvas,text='Cart',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')
lb1.place(x=240,y=210)
lb2.place(x=450,y=210)

con_us_btn=Button(main_canvas,text='Contact
Us',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=Contact_Us)
con_us_btn.place(x=660,y=210)

heading=Label(main_canvas,text='Payment Window',
font=('Grandview Display',18,'bold', 'underline'),
fg='dark green')
heading.place(x=350,y= 260)
59
Grocetaria
Only the best, eat the fresh!
reader=''
f=open('amount_data.dat', 'rb')
try :
reader=pickle.load(f)
except EOFError :
f.close()

amt_total=Label(main_canvas,text='Total Amount :
₹'+reader, font=('Grandview Display',16), fg='dark
green')
amt_total.place(x=10, y=300)

please_choose=Label(main_canvas,text='Please Choose a
preferred mode of payment :- ', font=('Grandview
Display',16), fg='dark green')
please_choose.place(x=10, y=350)
'''
des_frame=Frame(main_canvas,bg='black',width=780,heig
ht=115)
des_frame.place(x=15,y=390)
'''
name=StringVar()
name.set('Choose')
payment_choice=['Credit / Debit Cards',
'UPI','Wallets' ,'Net Banking', 'Pay On Delivery']
payment_menu=OptionMenu(main_canvas, name,
*payment_choice, command=payment_execute)
payment_menu.config(font=('Grandview
Displayi',12,'bold'),width=20, fg='white',bg='dark
green')
payment_menu.place(x=530, y=349)

main_screen.mainloop()

60
Grocetaria
Only the best, eat the fresh!
ORDER PLACED SCREEN :-

Code

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
import random, string, mysql.connector, webbrowser,
time, pickle, os, csv,subprocess,sys

def cart():
main_screen.destroy()
import cart_page

def Contact_Us():
main_screen.withdraw()
messagebox.showinfo('Contact Us','Mobile Number :
+91 12345 67890\nEmail :
support@grocetaria.co.in\nProject Email :
csprojectvm@gmail.com',)
main_screen.deiconify()
61
Grocetaria
Only the best, eat the fresh!
def Main_Page():
main_screen.destroy()
import mainscreen

def selected(event):
i=clicked.get()
cat(i)

def cat(a):
file=str(a)+'.py'
subprocess.Popen(['Python',file])
sys.exit(0)

def str_time_prop(start, end, time_format, prop):


stime = time.mktime(time.strptime(start,
time_format))
etime = time.mktime(time.strptime(end,
time_format))
ptime = stime + prop * (etime - stime)
return time.strftime(time_format,
time.localtime(ptime))

def random_date(start, end, prop):


return str_time_prop(start, end, '%d/%m/%Y',
prop)

main_screen=Tk()
main_screen.resizable(False,False)
main_screen.title('Grocetaria : Order Placed')
main_screen.geometry('880x495')
photo=PhotoImage(file='logo.png')
main_screen.iconphoto(False,photo)

main_frame=Frame(main_screen)
main_frame.pack(fill=BOTH,expand=1)
main_canvas=Canvas(main_frame)
main_canvas.pack(side=LEFT,fill=BOTH,expand=1)
scroll=ttk.Scrollbar(main_frame,orient=VERTICAL,comma
nd=main_canvas.yview)
62
Grocetaria
Only the best, eat the fresh!
scroll.pack(side=RIGHT,fill=Y)
main_canvas.configure(yscrollcommand=scroll.set)
main_canvas.bind('<Configure>',lambda e:
main_canvas.configure(scrollregion=main_canvas.bbox('
all')))
second_frame=Frame(main_canvas)
main_canvas.create_window((0,0),window=second_frame,a
nchor='nw')

photo1=PhotoImage(file='mainscreenlogo.png')
label1=Button(main_canvas,image=photo1, command=
Main_Page)
label1.place(x=0,y=0)
search_entry=Entry(main_canvas,font=('Calibri',13,'bo
ld'),width=75)
search_entry.place(x=60,y=150)
search_image=PhotoImage(file='searchbtn.png')
search_btn=Button(main_canvas,image=search_image)
search_btn.place(x=740,y=145)

clicked=StringVar()
clicked.set('Categories')
L=['Biscuits','Beverages','Canned
Food','Cereals','Flour and Refinery','Health
mix','Misc','Nuts','Pulses','Snacks','Spices','All
Products']
cat_drop=OptionMenu(main_canvas,clicked,*L,command=se
lected)
cat_drop.config(font=('Grandview
Displayi',12,'bold'),width=20, fg='white',bg='dark
green')
cat_drop.place(x=19,y=210)

lb1=Button(main_canvas,text='My
Profile',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')
lb2=Button(main_canvas,text='Cart',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green', command=cart)
63
Grocetaria
Only the best, eat the fresh!
lb1.place(x=240,y=210)
lb2.place(x=450,y=210)

con_us_btn=Button(main_canvas,text='Contact
Us',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green',command=Contact_Us)
con_us_btn.place(x=660,y=210)

order_msg=Label(main_canvas, text='You have


succesfully placed your order !', font=('Grandview
Display',17,'bold'), fg='dark green')
order_msg.place(x=220, y=250)

order_id='GROCE'
order_id+=''.join(random.choice(string.digits) for i
in range(15))
dummy1=Label(main_canvas, text='Order ID : ',
font=('Grandview Display',14), fg='dark green')
label_id=Label(main_canvas, text=order_id,
font=('Grandview Display',14), fg='dark green')
label_id.place(x=130, y=290)
dummy1.place(x=30, y=290)

dummy2=Label(main_canvas, text='Your order is


expected to be delivered by ', font=('Grandview
Display',14), fg='dark green')
dummy2.place(x=30, y=320)
del_date=random_date("1/2/2022", "28/2/2022",
random.random())
dummy3=Label(main_canvas, text=del_date+' .',
font=('Grandview Display',14), fg='dark green')
dummy3.place(x=385, y=321)

SS=Button(main_canvas,text='Download
Invoice',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')
SS.place(x=330, y= 372)

64
Grocetaria
Only the best, eat the fresh!
SS=Button(main_canvas,text='Close',font=('Grandview
Display',12,'bold'),width=20,fg='white',bg='dark
green')
SS.place(x=330, y= 410)
f=open('order_data.dat', 'wb')
order_data={'id':order_id, 'deliverydate':del_date}
pickle.dump(order_data,f)
f.close()

g=open('invoice.csv','w')
f=open('cart.dat','rb')
writer=csv.writer(g)
try :
while True :
reader=pickle.load(f)
writer.writerow(reader)
except EOFError :
pass
f.close()
g.close()

f=open('amount_data.dat', 'rb')
try :
while True :
reader=pickle.load(f)
print('Amount : ',reader)
except EOFError :
pass

f.close()

f=open('payment_data.dat', 'rb')
try :
while True :
reader=pickle.load(f)
print('Payment data : ', reader)
except EOFError :
pass
f.close()
65
Grocetaria
Only the best, eat the fresh!
f=open('cred_data.dat', 'rb')
try :
while True :
reader=pickle.load(f)
print('cred data : ',reader)
except EOFError :
pass
f.close()

f=open('cart.dat', 'rb')
try :
while True :
reader=pickle.load(f)
print('cart : ',reader)
except EOFError :
pass
f.close()

f=open('amount_data.dat', 'wb')
f.close()

f=open('payment_data.dat', 'wb')
f.close()

f=open('cred_data.dat', 'wb')
f.close()

f=open('order_data.dat', 'wb')
f.close()

f=open('cart.dat', 'wb')
f.close()

main_screen.mainloop()

66
Grocetaria
Only the best, eat the fresh!
ADMIN LOGIN SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import pickle
import random,subprocess,sys

def for_pwd():
subprocess.Popen(['Python','forgot.py'])
sys.exit(0)
def cat():
subprocess.Popen(['Python','adminpage.py'])
sys.exit(0)
def clear():
email_entry.delete(0,END)
pwd_entry.delete(0,END)
adlogin=Tk()
adlogin.title('Grocetaria : Administrator Login')
adlogin.geometry('900x500')
adlogin.resizable(False,False)
photo=PhotoImage(file='logo.png')
adlogin.iconphoto(False,photo)
67
Grocetaria
Only the best, eat the fresh!
def alogin_func():
if(email_entry.get()=="itadmin@grocetaria.co.in"
and pwd_entry.get()=="banana"):
messagebox.showinfo('Success!','Login
Successful ')
clear()
cat()
else:
if(email_entry.get()!="admin1234@gmail.com"):

messagebox.showerror('Error','Unauthorized Login.
\nIncorrect / Unregistered Email ID')
elif(pwd_entry.get()=="boredape$12"):

messagebox.showerror('Error','Unauthorized
Login.w\nIncorrect Password')
clear()
def back_fn():
subprocess.Popen(['Python','start.py'])
sys.exit(0)
def datapass():
a=email_entry.get
b=pwd_entry.get()
return a,b
bg_image=PhotoImage(file='bg.png')
bg_label=Label(adlogin,image=bg_image)
bg_label.place(x=0,y=0)

login_frame=Frame(adlogin,width=400,height=400,bg='wh
ite')
login_frame.place(x=230,y=45)

title_label=Label(login_frame,text='ADMIN
LOGIN',font=('Bahnschrift',28,'bold'),bg='white',fg='
black')
title_label.place(x=90,y=10)

email_label=Label(login_frame,text='Email
ID',bg='white',font=('Calibri',14,'bold'))
email_label.place(x=100,y=75)
68
Grocetaria
Only the best, eat the fresh!
password_label=Label(login_frame,text='Password',bg='
white',font=('Calibri',14,'bold'))
password_label.place(x=100,y=150)

email_entry=Entry(login_frame,font=('Calibri',14,'bol
d'))
pwd_entry=Entry(login_frame,font=('Calibri',14,'bold'
), show='*')
email_entry.place(x=100,y=100)
pwd_entry.place(x=100,y=175)

for_pwd_btn=Button(login_frame,text='Forgot Password
?',bg='white',font=('Calibri',9),fg='black',command=f
or_pwd)
for_pwd_btn.place(x=150,y=210)

login_btn_image=PhotoImage(file='log.png')
login_btn=Button(login_frame,image=login_btn_image,co
mmand=alogin_func)
login_btn.place(x=160,y=250)

a,b=datapass()
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(login_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

adlogin.mainloop()

69
Grocetaria
Only the best, eat the fresh!
ADMIN CENTER SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import subprocess,sys

admin_center=Tk()
admin_center.title('Grocetaria : Admin Center')
admin_center.geometry('880x600')
admin_center.resizable(False,False)
photo=PhotoImage(file='logo.png')
admin_center.iconphoto(False,photo)
bg_image=PhotoImage(file='bg.png')
bg_label=Label(admin_center,image=bg_image)
bg_label.place(x=0,y=0)
photo1=PhotoImage(file='mainscreenlogo.png')
label1=Label(admin_center,image=photo1)
label1.place(x=0,y=0)
edit_frame=Frame(admin_center,width=700,height=500,bg
='white')
edit_frame.place(x=80,y=160)

70
Grocetaria
Only the best, eat the fresh!
label2=Label(edit_frame, text='ADMIN CENTER',
font=('Bahnschrift', 28, 'bold'),bg='white', fg='dark
green')
label2.place(x=220,y=10)

def add():
subprocess.Popen(['Python','add.py'])
sys.exit(0)

def delete():
subprocess.Popen(['Python','delete.py'])
sys.exit(0)

def back_fn():
subprocess.Popen(['Python','adlogin.py'])
sys.exit(0)
def command():
subprocess.Popen(['python','adlogin.py'])
def modify():
subprocess.Popen(['python','modify.py'])

add=Button(edit_frame,text="Add
Items",bg='white',font=('calibri',20),width=20,fg='bl
ack',command=add)
add.place(x=220,y=100)
delete=Button(edit_frame,text="Delete
Items",bg="white",font=('calibri',20),width=20,fg='bl
ack',command=delete)
delete.place(x=220,y=200)
modify=Button(edit_frame,text='Modify
cost',bg='white',font=('calibri',20),width=20,fg='bla
ck',command=modify)
modify.place(x=220,y=300)
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(edit_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

admin_center.mainloop()

71
Grocetaria
Only the best, eat the fresh!
ADMIN CENTER – ADD ITEMS SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import mysql.connector
import subprocess,sys

def back_fn():
subprocess.Popen(['Python','adminpage.py'])
sys.exit(0)

m=Tk()
m.title("Grocetaria : Admin Center - Add Items")
m.geometry('600x450')
photo=PhotoImage(file='logo.png')
m.iconphoto(False,photo)
bg_image=PhotoImage(file='bg.png')
bg_label=Label(m,image=bg_image)
bg_label.place(x=0,y=0)
m_frame=Frame(m,width=400,height=400,bg='white')
m_frame.place(x=100,y=25)
72
Grocetaria
Only the best, eat the fresh!
def verify(a,b,c,d):
a=a.get()
b=b.get()
c=c.get()
d=d.get()
lst=[a,b,c,d]
if b=="" or c=="" or d=="" or a=="" :
messagebox.showerror('Error !','Invalid
ID Number')
clear()

else:
l=['NUTS','CANNED FOOD','FLOURAND
REFINERY','SNACKS','MISC','HEALTH
MIX','PULSES','BISCUIT']

con=mysql.connector.connect(host="localhost",user='ro
ot',password='1312',database='csproject')
mycursor=con.cursor()
mycursor.execute('select item_code from
projectdatabase')
flag=True
for i in mycursor:
if(i[0]==a):
flag=False
if(flag==False):
messagebox.showerror('Error !','Invalid
Item Code.\nCode already exists')

elif d.upper() not in l:


messagebox.showerror('Error !','Invalid /
Unavailable Category.')
else:
sql='insert into projectdatabase
values(%s,%s,%s,%s)'
mycursor.execute(sql,lst)
con.commit()
messagebox.showinfo('Success !','Item
successfully added.')
back_fn()
73
Grocetaria
Only the best, eat the fresh!
def clear():
itemcode_entry.delete(0,END)
productname_entry.delete(0,END)
cost_entry.delete(0,END)
category_entry.delete(0,END)

title_label=Label(m_frame,text='INSERT
ITEMS',font=('Bahnschrift',28,'bold'),bg='white',fg='
black')
title_label.place(x=100,y=10)
itemcode_label=Label(m_frame,text='Enter Item
Code',font=('Calibri',14,'bold'),bg='white')
itemcode_label.place(x=100,y=80)
strvar1=StringVar()
itemcode_entry=Entry(m_frame,font=('calibri',14,'bold
'),textvariable=strvar1)
itemcode_entry.place(x=100,y=105)

productname_label=Label(m_frame,text='Enter Product
Name ',font=('Calibri',14,'bold'),bg='white')
productname_label.place(x=100,y=130)
strvar2=StringVar()

productname_entry=Entry(m_frame,font=('calibri',14,'b
old'),textvariable=strvar2)
productname_entry.place(x=100,y=155)
cost_label=Label(m_frame,text='Enter
Cost',font=('Calibri',14,'bold'),bg='white')
cost_label.place(x=100,y=180)
strvar3=StringVar()
cost_entry=Entry(m_frame,font=('calibri',14,'bold'),t
extvariable=strvar3)
cost_entry.place(x=100,y=205)
category_label=Label(m_frame,text='Enter
Category',font=('Calibri',14,'bold'),bg='white')
category_label.place(x=100,y=230)
strvar4=StringVar()
category_entry=Entry(m_frame,font=('calibri',14,'bold
'),textvariable=strvar4)
74
Grocetaria
Only the best, eat the fresh!
category_entry.place(x=100,y=255)
'''a=itemcode_entry.get()
b=productname_entry.get()
c=cost_entry.get()
d=category_entry.get()'''

a=1
next_img=PhotoImage(file='next.png')
close=Button(m_frame,image=next_img,bg='white',font=(
'Calibri',18),fg='black',command=lambda a=a:
verify(strvar1,strvar2,strvar3,strvar4))
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(m_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)
close.place(x=150,y=300)

m.mainloop()

75
Grocetaria
Only the best, eat the fresh!
ADMIN CENTER – DELETE ITEMS SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import mysql.connector,subprocess,sys

def back_fn():
subprocess.Popen(['Python','adminpage.py'])
sys.exit(0)

m=Tk()
m.title("Grocetaria : Admin Center - Delete")
m.geometry('600x450')
photo=PhotoImage(file='logo.png')
m.iconphoto(False,photo)
bg_image=PhotoImage(file='bg.png')
bg_label=Label(m,image=bg_image).place(x=0, y=0)
m_frame=Frame(m,width=400,height=400,bg='white')
m_frame.place(x=100,y=25)

76
Grocetaria
Only the best, eat the fresh!
title_label=Label(m_frame,text='DELETE
ITEMS',font=("Bahnschrift",28,'bold'),bg='white',fg='
black')
title_label.place(x=100,y=10)
itemcode_label=Label(m_frame,text='Enter Item Code to
be deleted : ',font=('Calibri',14,'bold'),bg='white')
itemcode_label.place(x=80,y=180)
itemcode_entry=Entry(m_frame,font=('calibri',14,'bold
'),bg='white')
itemcode_entry.place(x=100,y=215)

def delete():
a=itemcode_entry.get()
if(a!=""):

con=mysql.connector.connect(host="localhost",user="ro
ot",password='1312',database='csproject')
mycursor=con.cursor()
mycursor.execute("select item_code from
projectdatabase")
f=0
for i in mycursor:
if(int(a)==int(i[0])):f=1

if(f==1):
mycursor.execute("delete from
projectdatabase where item_code="+str(a))
con.commit()
messagebox.showinfo('Success !',"Item
deleted Successfully")
back_fn()
else:
messagebox.showerror("Error !","Invalid
Item Code")

else:
messagebox.showerror("Error !","Invalid Item
Code")

next_img=PhotoImage(file='next.png')
77
Grocetaria
Only the best, eat the fresh!
close=Button(m_frame,fg='white',image=next_img,font=(
'Calibri',18),command=delete)
close.place(x=170,y=300)
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(m_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)

m.mainloop()

78
Grocetaria
Only the best, eat the fresh!
ADMIN CENTER – MODIFY COST SCREEN :-

Code

from tkinter import *


from tkinter import messagebox
import mysql.connector
import subprocess,sys

def back_fn():
subprocess.Popen(['Python','adminpage.py'])
sys.exit(0)
m=Tk()
def verify(a,b):
a=a.get()
b=b.get()

con=mysql.connector.connect(host="localhost",user='ro
ot',password='1234',database='csproject')
mycursor=con.cursor()

79
Grocetaria
Only the best, eat the fresh!
mycursor.execute('select item_code from
projectdatabase')
flag=False
for i in mycursor:
if(i[0]==a):
flag=True
if(flag==True):
messagebox.showerror('Error !','Invalid Item
Code.\n Code doesnt exist')
else:
#print('update projectdatabase set
cost='+str(b)+'where item_code='+str(a))
#print(a,b)
mycursor.execute('update projectdatabase set
cost='+str(b)+' where item_code='+str(a))
messagebox.showinfo('COST SUCCESFULLY
MODIFIED')
back_fn()
#con.commit()
def clear():
itemcode_entry.delete(0,END)
cost_entry.delete(0,END)
m=Tk()
m.title("Grocetaria : Admin Center - Modify cost")
m.geometry('600x450')
photo=PhotoImage(file='logo.png')
m.iconphoto(False,photo)
bg_image=PhotoImage(file='bg.png')
bg_label=Label(m,image=bg_image)
bg_label.place(x=0,y=0)
m_frame=Frame(m,width=400,height=400,bg='white')
m_frame.place(x=100,y=25)
title_label=Label(m_frame,text='MODIFY
COST',font=('Bahnschrift',28,'bold'),bg='white',fg='b
lack')
title_label.place(x=100,y=10)
itemcode_label=Label(m_frame,text='Enter Item
Code',font=('Calibri',14,'bold'),bg='white')
itemcode_label.place(x=100,y=80)
strvar1=StringVar()
80
Grocetaria
Only the best, eat the fresh!
itemcode_entry=Entry(m_frame,font=('calibri',14,'bold
'),textvariable=strvar1)
itemcode_entry.place(x=100,y=105)
cost_label=Label(m_frame,text='Enter New
Cost',font=('Calibri',14,'bold'),bg='white')
cost_label.place(x=100,y=180)
strvar2=StringVar()
cost_entry=Entry(m_frame,font=('calibri',14,'bold'),t
extvariable=strvar2)
cost_entry.place(x=100,y=205)
a=1
next_img=PhotoImage(file='next.png')
close=Button(m_frame,image=next_img,bg='white',font=(
'Calibri',18),fg='black',command=lambda a=a:
verify(strvar1,strvar2))
back_image=PhotoImage(file='back_btn.png')
back_btn=Button(m_frame,image=back_image,
command=back_fn)
back_btn.place(x=5,y=10)
close.place(x=150,y=300)

m.mainloop()

81
Grocetaria
Only the best, eat the fresh!
BIBLIOGRAPHY
• Python’s GUI using TKinter
https://www.youtube.com/playlist?list=PLCC34OHNcOtoC6GglhF3ncJ5rL
wQrLGnV

• Geeks For Geeks


https://www.geeksforgeeks.org/

• Stack Overflow
https://stackoverflow.com/

End Of Project Report


82
Grocetaria
Only the best, eat the fresh!

You might also like