0% found this document useful (0 votes)
6 views21 pages

Restaurant Billing System in Python

This document outlines a Python program using Tkinter for a restaurant billing system. It includes functionalities for user login, bill calculation, database integration with MySQL, and generating a bill receipt based on user input. The program also features error handling and the ability to clear input fields and reset the application state.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views21 pages

Restaurant Billing System in Python

This document outlines a Python program using Tkinter for a restaurant billing system. It includes functionalities for user login, bill calculation, database integration with MySQL, and generating a bill receipt based on user input. The program also features error handling and the ability to clear input fields and reset the application state.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import tkinter as tk

from tkinter import *#ing all the functions in the tkinter


##importing tkinter messsagebox
from tkinter import messagebox,Tk,Label
from datetime import datetime##to print date and time
from time import strftime##to print date and time
import tempfile,os,random

def login():
if [Link]()=='' or [Link]()=='':
[Link]('Error','Username And Password Cannot Be Empty')

elif [Link]()=='Mavericks' and [Link]()=='12345678':


[Link]('Success','Login Successful -- Welcome Mavericks')
[Link]()

#*************** R E S T A R U N T B I L I N G S Y S T E M
*******************
import [Link]

def init_db():
conn = [Link](
host="[Link]", # NOT localhost
user="root",
password="NABAN2008@",
port=3306,
connection_timeout=5,
use_pure=True
)
cur = [Link]()
[Link]("CREATE DATABASE IF NOT EXISTS restaurant_db")
[Link]()

init_db()

def save_bill_to_separate_table(bill_no, receipt_text):


conn = [Link](
host="[Link]", # NOT localhost
user="root",
password="NABAN2008@",
database="restaurant_db",
port=3306,
connection_timeout=5,
use_pure=True
)
cur = [Link]()

table_name = f"bill_{bill_no}"

# create table for this bill (ONLY ONE COLUMN)


[Link](f"""
CREATE TABLE IF NOT EXISTS {table_name} (
receipt LONGTEXT
)
""")

# insert bill text


[Link](
f"INSERT INTO {table_name} (receipt) VALUES (%s)",
(receipt_text,)
)

[Link]()
[Link]()

def total_():##defining total button as follows


##makking global use of a particular function
global
aprice,bprice,cprice,dprice,eprice,fprice,gprice,hprice,iprice,jprice
global
kprice,lprice,mprice,nprice,oprice,pprice,qprice,rprice,sprice,tprice
global
uprice,vprice,wprice,xprice,yprice,zprice,a1price,a2price,a3price,a4price
# global mytime
##giving the price for the dishes
#********************** S T A R T E R S ********************#
aprice=int([Link]())*50.00
bprice=int([Link]())*150.00
cprice=int([Link]())*85.00
dprice=int([Link]())*35.00
eprice=int([Link]())*160.00
fprice=int([Link]())*190.00
gprice=int([Link]())*210.00
hprice=int([Link]())*150.00
iprice=int([Link]())*90.00
jprice=int([Link]())*60.00
#********************** M A I N C O U R S E V A L U E S
********************#
kprice=int([Link]())*200.00
lprice=int([Link]())*350.00
mprice=int([Link]())*210.00
nprice=int([Link]())*350.00
oprice=int([Link]())*250.00
pprice=int([Link]())*370.00
qprice=int([Link]())*400.00
rprice=int([Link]())*300.00
sprice=int([Link]())*250.00
tprice=int([Link]())*250.00
#********************* D E S S E R T V A L U E S
*************************
uprice=int([Link]())*100.00
vprice=int([Link]())*250.00
wprice=int([Link]())*70.00
xprice=int([Link]())*230.00
yprice=int([Link]())*130.00
zprice=int([Link]())*70.00
a1price=int([Link]())*350.00
a2price=int([Link]())*80.00
a3price=int([Link]())*250.00
a4price=int([Link]())*250.00
##adding total costin the frame totframe

totprice=(aprice+bprice+cprice+dprice+eprice+fprice+gprice+hprice+iprice
+jprice+kprice+lprice+mprice+nprice+oprice+pprice

+qprice+rprice+sprice+tprice+uprice+vprice+wprice
+xprice+yprice+zprice+a1price+a2price+a3price+a4price)
[Link](state='normal')
[Link](0,END)##deleting preivious text wriiten in the entry
field
[Link](0,str(totprice)+' Rs')## inserting total price in
the entry field
[Link](state='disabled')

#*******************************************************************************
*************
def bill_():
billno=[Link](100,5000)
[Link](state='normal')
[Link](0,END)
[Link](0,billno)
[Link](state='disabled')
[Link](state='normal')
currentdate=[Link]().strftime('%d/%m/%y')
currenttime=[Link]().strftime('%I:%M:%S %p')
[Link](state='normal')
[Link](0,END)
[Link](state='normal')
[Link](0,END)
[Link](0,currentdate)
[Link](state='disabled')
[Link](0,currenttime)
[Link](state='disabled')
if [Link]()=='':
[Link]('Error','Select The Item')
elif [Link]()=='0 Rs':
[Link]('Error','Select The Item')
elif [Link]()=='':
[Link]('Error','Mode Of Payment -- Not Selected')
else:
[Link](1.0,END)
[Link](END,'\n\n\t MAVERICKS RESTAURANT (Pure
non-veg)\n')

[Link](END,'\n---------------------------------------------------------
')
[Link](END,f'\nBill Number:\t\t{[Link]()}')
[Link](END,'\n---------------------------------------------------------
')
if [Link]()!='':
[Link](END,f'\nDate:\t{[Link]()}')
if [Link]()!='':
[Link](END,f'\nTime:\t{[Link]()}')

[Link](END,'\n---------------------------------------------------------
')
[Link](END,'\nDish\t\t\tQuantity\t\t\tPrice')

[Link](END,'\n---------------------------------------------------------
')
if [Link]()!='0':
[Link](END,f'\nChicken
Rolls\t\t\t{[Link]()}\t\t\t{aprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChicken
Burger\t\t\t{[Link]()}\t\t\t{bprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChicken
Fries\t\t\t{[Link]()}\t\t\t{cprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nBread
Omellette\t\t\t{[Link]()}\t\t\t{dprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nMeat
Balls\t\t\t{[Link]()}\t\t\t{eprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChicken
Manchurian\t\t\t{[Link]()}\t\t\t{fprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChilli
Prawns\t\t\t{[Link]()}\t\t\t{gprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nFish
Fries\t\t\t{[Link]()}\t\t\t{hprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nSpecial
Shawarma\t\t\t{[Link]()}\t\t\t{iprice} Rs ')
if [Link]()!='0':

[Link](END,f'\nSoups\t\t\t{[Link]()}\t\t\t{jprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChicken
Biriyani\t\t\t{[Link]()}\t\t\t{kprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nMutton
Biriyani\t\t\t{[Link]()}\t\t\t{lprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nFish
Biriyani\t\t\t{[Link]()}\t\t\t{mprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nPrawn
Biriyani\t\t\t{[Link]()}\t\t\t{nprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nButter
Chicken\t\t\t{[Link]()}\t\t\t{oprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nTandoori
Chicken\t\t\t{[Link]()}\t\t\t{pprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nGrilled
Chicken\t\t\t{[Link]()}\t\t\t{qprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nSchezwan
Chicken\t\t\t{[Link]()}\t\t\t{rprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nEgg
Curry\t\t\t{[Link]()}\t\t\t{sprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nFish
Curry\t\t\t{[Link]()}\t\t\t{tprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nBread
Halwa\t\t\t{[Link]()}\t\t\t{uprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nVanilla
Frosting\t\t\t{[Link]()}\t\t\t{vprice} Rs ')
if [Link]()!='0':

[Link](END,f'\nKulfi\t\t\t{[Link]()}\t\t\t{wprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nApple
Pie\t\t\t{[Link]()}\t\t\t{xprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChocolate
Brownie\t\t\t{[Link]()}\t\t\t{yprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nPumpkin
Cupcakes\t\t\t{[Link]()}\t\t\t{zprice} Rs ')
if [Link]()!='0':
[Link](END,f'\nChocolate
Cake\t\t\t{[Link]()}\t\t\t{a1price} Rs ')
if [Link]()!='0':
[Link](END,f'\nBanana
Bars\t\t\t{[Link]()}\t\t\t{a2price} Rs ')
if [Link]()!='0':
[Link](END,f'\nChoco
Truffle\t\t\t{[Link]()}\t\t\t{a3price} Rs ')
if [Link]()!='0':
[Link](END,f'\nRed
Velvet\t\t\t{[Link]()}\t\t\t{a4price} Rs ')

[Link](END,'\n---------------------------------------------------------
')
totalbill=[Link]()
[Link](END,f'\n\tTotalBill\t\t\t\t{totalbill}',)
[Link](END,'\n---------------------------------------------------------
')
corc=[Link]()
if [Link]()!='':
[Link](END,f'\nMode Of Payment: \t\t{corc}')

[Link](END,'\n---------------------------------------------------------
')
[Link](END,'\n\t\tThankyou For Dining With Us :)')

# Save bill to MySQL database


full_bill_text = [Link](1.0, END)
save_bill_to_separate_table(int([Link]()),
full_bill_text)

[Link](state='disabled')

#*******************************************************************************
********
#deleting all the values in he entryfields after clicking of clear
button
def clear_():##deffining the clear button as follows
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
[Link](state='normal')
[Link](0,END)
[Link](state='disabled')
##deleting the text written on the text area after clicking the
clear button
[Link](state='normal')
[Link](1.0,END)
[Link](state='disabled')
##deleting the text written on the entryfields of dt after clicking
the clear button
[Link](state='normal')
[Link](0,END)
[Link](state='disabled')
[Link](state='normal')
[Link](0,END)
[Link](state='disabled')
[Link](state='normal')
[Link](0,END)
[Link](state='disabled')
[Link](state='normal')
[Link](0,END)
[Link](state='disabled')
##again we are inserting the value 0
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
[Link](0,0)
#*******************************************************************************
******
def close_():
[Link]()

def print_():
if [Link](1.0,END)=='\n':
[Link]('Error','Bill Is Empty')
else:
file=[Link]('.txt')
open(file,'w').write([Link](1.0,END))
[Link](file,'print')

#********** G U I (GRAPHICAL USER INTERFACE) P A R T


*********#
#******** T K I N T E R *******#

# initialize database
init_db()

win=[Link]()
[Link]('Restaurant Billing System') ##giving title for the new
window
[Link](bg='#FAF3E0') ##bg colour for window
[Link]('1319x634') #giving geometry for the new window length x
bregth
[Link](0,0) ##dont want to maximize the window

headinglabel = Label(win, text="Mavericks Restaurant (Pure non-veg) :)"


,fg='yellow',bg='dark blue', font=("segoe script",
25, 'bold'))
[Link](fill='both',pady='2',) ##positioning the label
##making a frame
dish1frame=Frame(win)
[Link](bg='#FAF3E0')
[Link](fill='both') ##positioning the frame
##making a frame for starters
startersFrame=LabelFrame(dish1frame, text="Starters"
, font=("segoe script",21, 'bold',))
[Link](fg='yellow') ##foreground colour
[Link](bg='dark blue') ##background
[Link](row=0,column=0,padx='3') #positioning
# Allow only numbers or empty string
def validate_int(P):
if [Link]() or P == "":
return True
return False
vcmd = ([Link](validate_int), "%P")##copied from chatGPT

#*******************************************************************************
********************
def aclick(event):
[Link]('Message','Chicken Rolls - 50.00 Rs')
def bclick(event):
[Link]('Message','Chicken Burger - 150.00 Rs')
def cclick(event):
[Link]('Message','Chicken Fries - 85.00 Rs')
def dclick(event):
[Link]('Message','Bread Omelette - 35.00')
def eclick(event):
[Link]('Message','Meat Balls - 160.00 Rs')
def fclick(event):
[Link]('Message','Chicken Manchurian - 190.00 Rs')
def gclick(event):
[Link]('Message','Chilli Prawns - 210.00 Rs')
def hclick(event):
[Link]('Message','Fish Fries - 150.00 Rs')
def iclick(event):
[Link]('Message','Special Shawarma - 90.00 Rs')
def jclick(event):
[Link]('Message','Soups - 60.00 Rs')
def kclick(event):
[Link]('Message','Chicken Biriyani - 200.00 Rs')
def lclick(event):
[Link]('Message','Mutton Biriyani - 350.00 Rs')
def mclick(event):
[Link]('Message','Fish Biriyani - 210.00 Rs')
def nclick(event):
[Link]('Message','Prawn Biriyani - 350.00 Rs')
def oclick(event):
[Link]('Message','Butter Chicken - 250.00 Rs')
def pclick(event):
[Link]('Message','Tandoori Chicken - 370.00 Rs')
def qclick(event):
[Link]('Message','Grilled Chicken - 400.00 Rs')
def rclick(event):
[Link]('Message',' Schezwan Chicken - 300.00 Rs')
def sclick(event):
[Link]('Message',' Egg Curry - 250.00 Rs')
def tclick(event):
[Link]('Message',' Fish Curry - 250.00 Rs')
def uclick(event):
[Link]('Message',' Bread Halwa - 100.00 Rs')
def vclick(event):
[Link]('Message','Vanilla Frosting - 250.00 Rs')
def wclick(event):
[Link]('Message',' Kulfi - 70.00 Rs')
def xclick(event):
[Link]('Message',' Apple Pie - 230.00 Rs')
def yclick(event):
[Link]('Message',' Chocolate Brownie - 130.00 Rs')
def zclick(event):
[Link]('Message',' Pumpkin Cupcakes - 70.00 Rs')
def a1click(event):
[Link]('Message',' Chocolate Cake - 350.00 Rs')
def a2click(event):
[Link]('Message',' Banana Bars - 80.00 Rs')
def a3click(event):
[Link]('Message',' Choco Truffle - 250.00 Rs')
def a4click(event):
[Link]('Message',' Red Velvet - 250.00 Rs')
##copied from chatGPT

#*******************************************************************************
********************************
##adding of chiken spring roll in starters frame
##a(chicken)
aLabel=Label(startersFrame, text="Chicken Rolls"
, font=("times new roman", 17, 'bold'))
[Link](fg='#FAF3E0') ##foreground colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=0) ##positioning
[Link]('<Button-1>',aclick)
aEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=0,column=1) ##positioning into the startersframe
##acheck=[Link](startersFrame)
##[Link](row=0,column=0)
##adding of burger in starters frame
##b(burger)
bLabel=Label(startersFrame, text="Chicken Burger"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ## foreground colour
[Link](bg='dark blue') ##background colour
[Link](row=1,column=0) #positioning
[Link]('<Button-1>',bclick)
bEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=1,column=1) ##positioning into the startersframe
##adding of Chicken Fries in starters frame
##c(Chicken Fries)
cLabel=Label(startersFrame, text="Chicken Fries"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour
[Link](bg='dark blue') ##background colour
[Link](row=2,column=0) #positioning
[Link]('<Button-1>',cclick)
cEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=2,column=1) ##positioning into the startersframe
##adding of bread omllette in starters frame
##d(bread omellete)
dLabel=[Link](startersFrame, text="Bread Omellette"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=3,column=0) #positioning
[Link]('<Button-1>',dclick)
dEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=3,column=1) ##positioning into the startersframe
##adding of meat balls in starters frame
##e(meat balls)
eLabel=Label(startersFrame, text="Meat Balls "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=4,column=0) #positioning
[Link]('<Button-1>',eclick)
eEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=4,column=1) ##positioning into the startersframe
##adding of chicken manchurian in starters frame
##f(chicken manchurian)
fLabel=Label(startersFrame, text="Chicken Manchurian "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=5,column=0) #positioning
[Link]('<Button-1>',fclick)
fEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=5,column=1) ##positioning into the startersframe

##adding of chilli prawns in starters frame


##g(chilli prawns)
gLabel=Label(startersFrame, text="Chilli Prawns "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=6,column=0) #positioning
[Link]('<Button-1>',gclick)
gEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=6,column=1) ##positioning into the startersframe
##adding of fish Chicken Fries in starters frame
##h(Chicken Fries )
hLabel=Label(startersFrame, text="Fish Fries"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=7,column=0) #positioning
[Link]('<Button-1>',hclick)
hEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=7,column=1) ##positioning into the startersframe
##adding of chicken shawarma in starters frame
##i(chicken shawarma)
iLabel=Label(startersFrame, text="Special Shawarma"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=8,column=0) #positioning
[Link]('<Button-1>',iclick)
iEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=8,column=1) ##positioning into the startersframe
##adding of soups in starters frame
##j(soups)
jLabel=Label(startersFrame, text="Soups"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=9,column=0) #positioning
[Link]('<Button-1>',jclick)
jEntry=Entry(startersFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=9,column=1,padx=7) ##positioning into the
startersframe
#************* M A I N C O U R C E F R A M E
*************#
##making a frame2 for starters
maincourseFrame=LabelFrame(dish1frame, text="Main Course"
, font=("segoe script", 21, 'bold',))
[Link](fg='yellow') ##foreground colour
[Link](bg='dark blue') ##background
[Link](row=0,column=1,padx='3') #positioning
##adding of chicken biriyani in main course frame
##k(chicken biriyani)
kLabel=Label(maincourseFrame, text="Chicken Biriyani "
,font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=0) #positionin
[Link]('<Button-1>',kclick)
kEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=0,column=1,padx=7) ##positioning into the
maincourseframe
##adding of Mutton biriyani in main course frame
##l(muttoon biriyani)
lLabel=Label(maincourseFrame, text="Mutton Biriyani "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=1,column=0) #positionin
[Link]('<Button-1>',lclick)
lEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=1,column=1) ##positioning into the maincourseframe
##adding of fish biriyani in main course frame
#m(fish biriyani)
mLabel=Label(maincourseFrame, text="Fish Biriyani "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=2,column=0) #positioning
[Link]('<Button-1>',mclick)
mEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=2,column=1) ##positioning into the maincourseframe
##adding of prawn biriyani in main course frame
##n(prawn biriyani)
nLabel=Label(maincourseFrame, text="Prawn Biriyani "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=3,column=0) #positioning
[Link]('<Button-1>',nclick)
nEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=3,column=1) ##positioning into the maincourseframe
##adding of butter chicken in main course frame2
##o(butter chicken)
oLabel=Label(maincourseFrame, text="Butter Chicken "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=4,column=0) #positioning
[Link]('<Button-1>',oclick)
oEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=4,column=1) ##positioning into the maincourseframe
##adding of tandoori chicken in main course frame
##p(tandoori chicken)
pLabel=Label(maincourseFrame, text="Tandoori Chicken "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=5,column=0) #positioning
[Link]('<Button-1>',pclick)
pEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=5,column=1) ##positioning into the maincourseframe
##adding of grillled chicken in main course frame
##q(grilled chicken)
qLabel=Label(maincourseFrame, text="Grilled Chicken "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=6,column=0) #positioning
[Link]('<Button-1>',qclick)
qEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=6,column=1) ##positioning into the maincourseframe
##adding of schezwan chicken in main course frame
##r(schezwan chicken)
rLabel=Label(maincourseFrame, text="Schezwan Chicken "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=7,column=0) #positioning
[Link]('<Button-1>',rclick)
rEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=7,column=1) ##positioning into the maincourseframe
##adding of egg curry in main course frame
##s(egg curry)
sLabel=Label(maincourseFrame, text="Egg Curry "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=8,column=0) #positioning
[Link]('<Button-1>',sclick)
sEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=8,column=1) ##positioning into maincourseframe
##adding of fish curry in main course frame
##t(fish curry)
tLabel=Label(maincourseFrame, text="Fish Curry "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=9,column=0) ##positioning
[Link]('<Button-1>',tclick)
tEntry=Entry(maincourseFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=9,column=1) ##positioning into the maincourseframe

#*********************** D E S E R T F R A M E
*********************#
##making a frame3 for dessert
dessertFrame=LabelFrame(dish1frame, text="Dessert"
, font=("segoe script", 21, 'bold',))
[Link](fg='yellow') ##foreground colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=2,padx=3) #positioning
##adding of bread halwa in main course frame
##u(breadhalwa)
uLabel=Label(dessertFrame, text="Bread Halwa "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=0) #positioning
[Link]('<Button-1>',uclick)
uEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=0,column=1) ##positioning into the dessertsframe
##adding of Vanilla Frosting in main course frame
##v(chocolate Cake With Vanilla Frosting
vLabel=Label(dessertFrame, text="Vanilla Frosting "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=1,column=0) #positioning
[Link]('<Button-1>',vclick)
vEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=1,column=1) ##positioning into the dessertframe)
##adding of kulfi in main course frame
##w(kulfi)
wLabel=Label(dessertFrame, text="Kulfi "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=2,column=0) #positioning
[Link]('<Button-1>',wclick)
wEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=2,column=1) ##positioning into the dessertframe
##adding of apple pie in main course frame
##x(apple pie)
xLabel=Label(dessertFrame, text="Apple Pie "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=3,column=0) #positioning
[Link]('<Button-1>',xclick)
xEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=3,column=1) ##positioning into the dessertframe
##adding of chocolate brownie in main course frame
##y(cbrownie)
yLabel=Label(dessertFrame, text="Chocolate brownie "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=4,column=0) #positioning
[Link]('<Button-1>',yclick)
yEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field\
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=4,column=1) ##positioning into the dessertframe
##adding of Pumpkin cupcakes in main course frame
##z(Pumpkin cupcakes)
zLabel=Label(dessertFrame, text="Pumpkin Cupcakes "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=5,column=0) #positioning
[Link]('<Button-1>',zclick)
zEntry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=5,column=1) ##positioning into the dessertframe)
##adding of chocolate cake in main course frame
##a1(chocolate cake)
a1Label=Label(dessertFrame, text="Chocolate Cake "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=6,column=0) #positioning
[Link]('<Button-1>',a1click)
a1Entry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=6,column=1) ##positioning into the dessertframe)
##adding of Banana bars in main course frame
##a2(Banana bars)
a2Label=Label(dessertFrame, text="Banana Bars "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=7,column=0) #positioning
[Link]('<Button-1>',a2click)
a2Entry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=7,column=1) ##positioning into the dessertframe)
##adding of choco truffle in main course frame
##a3(choco truffle)
a3Label=Label(dessertFrame, text="Choco Truffle "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=8,column=0) #positioning
[Link]('<Button-1>',a3click)
a3Entry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=8,column=1) ##positioning into the dessertframe)
##adding of red velvet in main course frame
##a4(red velvet)
a4Label=Label(dessertFrame, text="Red Velvet "
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=9,column=0) #positioning
[Link]('<Button-1>',a4click)
a4Entry=Entry(dessertFrame, validate="key",
validatecommand=vcmd,width=5,bd='3') ##entry field
[Link](0,0) ##inserting '0' after clicking the button clear
[Link](row=9,column=1,padx=5) ##positioning into the
dessertframe)

#********************* B I L L I N G A R E A
**********************
##making billframe
billframe=Frame(dish1frame)
[Link](row=0,column=3,padx='5',sticky='s')
##making bilarealabel inside the billfframe
billarealabel=Label(billframe ,text="C u s t o m e r B i l l"
, font=("Courier New", 17, 'bold'),bg='dark
blue',fg='yellow')
[Link](bg='dark blue')
[Link](bd='8')
[Link](relief='groove')
[Link]()
##making sccroolbar in billframe
scrollbar=Scrollbar(billframe,orient='vertical')##placiing scroolbar in
vertical
[Link](side='right',fill='y')##positioning at right side to the
text area
##making textarea in billframe

textarea=Text(billframe,height=16,width=57,yscrollcommand=[Link],state='d
isabled')
[Link]()
##configuring scrollbar too view text
[Link](command=[Link])

billnoframe=LabelFrame(dish1frame,bd='8',bg='dark blue')
[Link](row=0,column=3,sticky='n')
billnolabel=Label(billnoframe,text=' Bill Number : '
,font=('segoe script',13,'bold'),fg='yellow',bg='dark
blue',bd='1')
[Link](row=0,column=0)
billnoEntry=Entry(billnoframe,width=5,font=('arial',12),bd='5')
[Link](state='disabled')
[Link](row=0,column=1,padx=20)
space=Label(billnoframe,text='
',bg='dark blue')
[Link](row=0,column=2)
##making a labelframe for bil menu
##bm(billmenu)
bmFrame=LabelFrame(win, text=""
, font=("times new roman", 21, 'bold',))
[Link](fg='yellow') ##foreground colour
[Link](bg='dark blue') ##background colour
[Link](bd='7') ## border size
[Link](fill='both',padx=7,pady=7) #positioning
##adding of total price in frame
##tot(total price)
totprice=Label(bmFrame, text="Total Price : "
, font=("segoe script", 25, 'bold',))
[Link](fg='yellow') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=0,padx=15) #positioning
totEntry=Entry(bmFrame,font=('arial',28),width=12,bd='5') ##entry
field
[Link](state='disabled')
[Link](row=0,column=1,padx=10,pady=5) ##positioning
##adding of total price in frame
##mod(mod of pyment)
modpay=Label(bmFrame, text="Mode Of Payment : "
, font=("segoe script", 18, 'bold',))
[Link](fg='yellow') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](row=0,column=2,padx=5) #positioning

def cash_():
[Link](state='normal')
[Link](0,END)
[Link](0,'CASH')
[Link](state='disabled')
##creating total button
cashbutton=Button(bmFrame, text="Cash"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='5')
[Link](command=cash_)
[Link](row=0,column=3,pady=5,)
def card_():
[Link](state='normal')
[Link](0,END)
[Link](0,'CARD')
[Link](state='disabled')
##creating total button
cardbutton=Button(bmFrame, text="Card"
, font=("times new roman", 17, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](command=card_)
[Link](row=0,column=4,padx=35,pady=5)
def upi_():
[Link](state='normal')
[Link](0,END)
[Link](0,'UPI')
[Link](state='disabled')
##creating total button
upibutton=Button(bmFrame, text="UPI"
, font=("times new roman", 17, 'bold',))
[Link](bd='5')
[Link](width='5')
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='5')
[Link](command=upi_)
[Link](row=0,column=5,pady=5,)

modEntry=Entry(bmFrame,font=('arial',20),width=5,bd='5') ##entry field

#*******************************************************************************
***********
[Link](state='disabled')
[Link](row=0,column=6,padx=37,pady=5) ##positioning

##making a labelframe for bil menu


##button
buttonframe=LabelFrame(win, text=""
, font=("times new roman", 21, 'bold',))
[Link](fg='yellow') ##foreground
[Link](bg='dark blue') ##background colour
[Link](bd='7') ## border size
[Link]() #positioning
##creating total button
totalbutton=Button(buttonframe, text="Total "
, font=("times new roman", 20, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='7')
[Link](command=total_)
[Link](row=1,column=0,padx=40,pady=5,rowspan=2)
##creating bill button
billbutton=Button(buttonframe, text="Bill "
, font=("times new roman", 20, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='7')
[Link](command=bill_)
[Link](row=1,column=1,padx=40,rowspan=2)
##creating print button
printbutton=Button(buttonframe, text="Print "
, font=("times new roman", 20, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='7')
[Link](command=print_)
[Link](row=1,column=2,padx=40,rowspan=2)
##creating clear button
clearbutton=Button(buttonframe, text="Clear "
, font=("times new roman", 20, 'bold'))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='7')
[Link](command=clear_)
[Link](row=1,column=3,padx=40,rowspan=2)

##creating close button


closebutton=Button(buttonframe, text="Close "
, font=("times new roman", 20, 'bold',))
[Link](fg='#FAF3E0') ##foreground colour colour
[Link](bg='dark blue') ##background colour
[Link](bd='5')
[Link](width='7')
[Link](command=close_)
[Link](row=1,column=4,padx=40,rowspan=2)

datelabel=Label(buttonframe,text='Date: ',font=('segoe script',20))


[Link](fg='yellow',bg='dark blue')
[Link](row=1,column=5,)

dateEntry=Entry(buttonframe,font=('arial',17),width=7,bd='5',state='disabled')
##entry field
[Link](row=1,column=6,pady=6) ##positioning

timelabel=Label(buttonframe,text='Time: ',font=('segoe script',20))


[Link](fg='yellow',bg='dark blue')
[Link](row=2,column=5)

timeEntry=Entry(buttonframe,font=('arial',17),width=10,bd='5',state='disabled')
##entry field
[Link](row=2,column=6,pady=6,padx=10) ##positioning

#*******************************************************************************
******
##for looping
[Link]()

else:
[Link]('Error','Please Enter The Correct Credentials')

def close():
[Link]()
window=Tk()
[Link]('700x500+330+100')
[Link]('Login Page') ##giving title for the new window
[Link](bg='dark blue') ##bg colour for window
[Link](False,False)

loginlabel=Label(window,text='LOGIN',fg='yellow',bg='dark
blue',bd=7,relief="groove",font=("times new roman", 40, 'bold'))
[Link](fill='x')

loginframe=Frame(window,bg='dark blue',bd=7,relief="groove")
[Link](x=400,y=150)
[Link](fill='both')

usernamelabel=Label(loginframe,text='Username',fg='white',bg='dark
blue',font=("segoe script", 30, 'bold'))
[Link](row=0,column=0,ipadx=100,ipady=50,)

usernameentry=Entry(loginframe,width=15,font=('arial',17),bd=5)
[Link](row=0,column=1)

passwordlabel=Label(loginframe,text='Password',fg='white',bg='dark blue',
font=("segoe script", 30, 'bold'))
[Link](row=1,column=0,)

passwordentry=Entry(loginframe,width=15,font=('arial',17),bd=5)
[Link](row=1,column=1)

loginbutton=Button(loginframe,text='Login',fg='white',bg='dark blue',
font=("segoe script", 18, 'bold')
,bd=7,cursor='hand2',command=login)
[Link](row=2,column=0,ipadx=30,pady=45,columnspan=1)

closebutton=Button(loginframe,text='Close',fg='white',bg='dark blue',
font=("segoe script", 18, 'bold')
,bd=7,cursor='hand2',command=close)
[Link](row=2,column=1,ipadx=30,pady=45,columnspan=1)

[Link]()

You might also like