|
| 1 | +from tkinter import* |
| 2 | +import random |
| 3 | +import time |
| 4 | + |
| 5 | +root = Tk() |
| 6 | +root.geometry("1600x800+0+0") |
| 7 | +root.title("Restaurant Management Systems") |
| 8 | + |
| 9 | +text_input = StringVar() |
| 10 | +operator = "" |
| 11 | + |
| 12 | +Tops = Frame(root, width=1600, height=600, bg="white", relief=GROOVE) |
| 13 | +Tops.pack(side=TOP) |
| 14 | + |
| 15 | +f1 = Frame(root, width=900, height=700, bg="white", relief=GROOVE) |
| 16 | +f1.pack(side=LEFT) |
| 17 | + |
| 18 | +f2 = Frame(root, width=300, height=700, bg="sky blue", relief=GROOVE) |
| 19 | +f2.pack(side=RIGHT) |
| 20 | +# =====================TIME======================================== |
| 21 | +localtime = time.asctime(time.localtime(time.time())) |
| 22 | + |
| 23 | +lblInfo = Label(Tops, font=('arial', 50, 'bold'), text="Restaurant Management Systems", fg="Black", bd=10) |
| 24 | +lblInfo.grid(row=0, column=0) |
| 25 | +lblInfo = Label(Tops, font=('arial', 20, 'bold'), text=localtime, fg="Black", bd=10) |
| 26 | +lblInfo.grid(row=1, column=0) |
| 27 | +# =========================calculator================================= |
| 28 | + |
| 29 | + |
| 30 | +def btnclick(numbers): |
| 31 | + global operator |
| 32 | + operator = operator+str(numbers) |
| 33 | + text_input.set(operator) |
| 34 | + |
| 35 | + |
| 36 | +def btnClearDisplay(): |
| 37 | + global operator |
| 38 | + operator = " " |
| 39 | + text_input.set("") |
| 40 | + |
| 41 | + |
| 42 | +def btnEqualsInput(): |
| 43 | + global operator |
| 44 | + sumup = str(eval(operator)) |
| 45 | + text_input.set(sumup) |
| 46 | + operator = "" |
| 47 | + |
| 48 | + |
| 49 | +def Ref(): |
| 50 | + x = random.randint(12908, 500876) |
| 51 | + randomRef = str(x) |
| 52 | + rand.set(randomRef) |
| 53 | + |
| 54 | + |
| 55 | +def Exit(): |
| 56 | + root.destroy() |
| 57 | + |
| 58 | + |
| 59 | +def Reset(): |
| 60 | + rand.set("") |
| 61 | + Fries.set("") |
| 62 | + Burger.set("") |
| 63 | + Filet.set("") |
| 64 | + SubTotal.set("") |
| 65 | + Total.set("") |
| 66 | + Service_Charge.set("") |
| 67 | + Drinks.set("") |
| 68 | + Tax.set("") |
| 69 | + Cost.set("") |
| 70 | + Chicken_Burger.set("") |
| 71 | + Cheese_Burger.set("") |
| 72 | + |
| 73 | + |
| 74 | +txtdisplay = Entry(f2, font=('arial', 20, 'bold'), textvariable=text_input, bd=30, |
| 75 | + insertwidth=4, bg="sky blue", justify='right') |
| 76 | +txtdisplay.grid(columnspan=4) |
| 77 | + |
| 78 | +btn7 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 79 | + text="7", bg="sky blue", command=lambda: btnclick(7)).grid(row=2, column=0) |
| 80 | +btn8 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 81 | + text="8", bg="sky blue", command=lambda: btnclick(8)).grid(row=2, column=1) |
| 82 | +btn9 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 83 | + text="9", bg="sky blue", command=lambda: btnclick(9)).grid(row=2, column=2) |
| 84 | +Addition = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 85 | + text="+", bg="sky blue", command=lambda: btnclick("+")).grid(row=2, column=3) |
| 86 | +# ======================================================================== |
| 87 | +btn4 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 88 | + text="4", bg="sky blue", command=lambda: btnclick(4)).grid(row=3, column=0) |
| 89 | +btn5 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 90 | + text="5", bg="sky blue", command=lambda: btnclick(5)).grid(row=3, column=1) |
| 91 | +btn6 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 92 | + text="6", bg="sky blue", command=lambda: btnclick(6)).grid(row=3, column=2) |
| 93 | +Subtraction = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 94 | + text="-", bg="sky blue", command=lambda: btnclick("-")).grid(row=3, column=3) |
| 95 | +# ========================================================================= |
| 96 | +btn1 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 97 | + text="1", bg="sky blue", command=lambda: btnclick(1)).grid(row=4, column=0) |
| 98 | +btn2 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 99 | + text="2", bg="sky blue", command=lambda: btnclick(2)).grid(row=4, column=1) |
| 100 | +btn3 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 101 | + text="3", bg="sky blue", command=lambda: btnclick(3)).grid(row=4, column=2) |
| 102 | +Multiply = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 103 | + text="*", bg="sky blue", command=lambda: btnclick("*")).grid(row=4, column=3) |
| 104 | +# =========================================================================== |
| 105 | +btn0 = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 106 | + text="0", bg="sky blue", command=lambda: btnclick(0)).grid(row=5, column=0) |
| 107 | +btnclear = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 108 | + text="C", bg="sky blue", command=btnClearDisplay).grid(row=5, column=1) |
| 109 | +btnEquals = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 110 | + text="=", bg="sky blue", command=btnEqualsInput).grid(row=5, column=2) |
| 111 | +Division = Button(f2, padx=16, pady=16, bd=8, fg="black", font=('arial', 20, 'bold'), |
| 112 | + text="/", bg="sky blue", command=lambda: btnclick("/")).grid(row=5, column=3) |
| 113 | +# =====================================Restaurant Info 1======================================= |
| 114 | +rand = StringVar() |
| 115 | +Fries = StringVar() |
| 116 | +Burger = StringVar() |
| 117 | +Filet = StringVar() |
| 118 | +SubTotal = StringVar() |
| 119 | +Total = StringVar() |
| 120 | +Service_Charge = StringVar() |
| 121 | +Drinks = StringVar() |
| 122 | +Tax = StringVar() |
| 123 | +Cost = StringVar() |
| 124 | +Chicken_Burger = StringVar() |
| 125 | +Cheese_Burger = StringVar() |
| 126 | + |
| 127 | +lblReference = Label(f1, font=('arial', 16, 'bold'), text="Reference", bd=16, anchor='w') |
| 128 | +lblReference.grid(row=0, column=0) |
| 129 | +txtReference = Entry(f1, font=('arial', 16, 'bold'), textvariable=rand, bd=10, insertwidth=4, |
| 130 | + bg="sky blue",justify='right') |
| 131 | +txtReference.grid(row=0, column=1) |
| 132 | + |
| 133 | +lblFries = Label(f1, font=('arial', 16, 'bold'), text="Large Fries", bd=16, anchor='w') |
| 134 | +lblFries.grid(row=1, column=0) |
| 135 | +txtFries = Entry(f1, font=('arial', 16, 'bold'), textvariable=Fries, bd=10, insertwidth=4, |
| 136 | + bg="sky blue", justify='right') |
| 137 | +txtFries.grid(row=1, column=1) |
| 138 | + |
| 139 | +lblBurger = Label(f1, font=('arial', 16, 'bold'), text="Burger Meal", bd=16, anchor='w') |
| 140 | +lblBurger.grid(row=2, column=0) |
| 141 | +txtBurger = Entry(f1, font=('arial', 16, 'bold'), textvariable=Burger, bd=10, insertwidth=4, |
| 142 | + bg="sky blue", justify='right') |
| 143 | +txtBurger.grid(row=2, column=1) |
| 144 | + |
| 145 | + |
| 146 | +lblFilet = Label(f1, font=('arial', 16, 'bold'), text="Filet_O_Meal", bd=16, anchor='w') |
| 147 | +lblFilet.grid(row=3, column=0) |
| 148 | +txtFilet = Entry(f1, font=('arial', 16, 'bold'), textvariable=Filet, |
| 149 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 150 | +txtFilet.grid(row=3, column=1) |
| 151 | + |
| 152 | + |
| 153 | +lblChicken = Label(f1, font=('arial', 16, 'bold'), text="Chicken Meal", bd=16, anchor='w') |
| 154 | +lblChicken.grid(row=4, column=0) |
| 155 | +txtChicken = Entry(f1, font=('arial', 16, 'bold'), textvariable=Chicken_Burger, bd=10, insertwidth=4, |
| 156 | + bg="sky blue", justify='right') |
| 157 | +txtChicken.grid(row=4, column=1) |
| 158 | + |
| 159 | +lblCheese = Label(f1, font=('arial', 16, 'bold'), text="Cheese Meal", bd=16, anchor='w') |
| 160 | +lblCheese.grid(row=5, column=0) |
| 161 | +txtCheese = Entry(f1, font=('arial', 16, 'bold'), textvariable=Cheese_Burger, |
| 162 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 163 | +txtCheese.grid(row=5, column=1) |
| 164 | + |
| 165 | +# ===================Restaurant Info 2================================================ |
| 166 | + |
| 167 | +lblDrinks = Label(f1, font=('arial', 16, 'bold'), text="Drinks", bd=16, anchor='w') |
| 168 | +lblDrinks.grid(row=0, column=2) |
| 169 | +txtDrinks = Entry(f1, font=('arial', 16, 'bold'), textvariable=Drinks, |
| 170 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 171 | +txtDrinks.grid(row=0, column=3) |
| 172 | + |
| 173 | +lblCost = Label(f1, font=('arial', 16, 'bold'), text="Cost of Meal", bd=16, anchor='w') |
| 174 | +lblCost.grid(row=1, column=2) |
| 175 | +txtCost = Entry(f1, font=('arial', 16, 'bold'), textvariable=Cost, |
| 176 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 177 | +txtCost.grid(row=1, column=3) |
| 178 | + |
| 179 | +lblService = Label(f1, font=('arial', 16, 'bold'), text="Service Charge", bd=16, anchor='w') |
| 180 | +lblService.grid(row=2, column=2) |
| 181 | +txtService = Entry(f1, font=('arial', 16, 'bold'), textvariable=Service_Charge, bd=10, insertwidth=4, |
| 182 | + bg="sky blue", justify='right') |
| 183 | +txtService.grid(row=2, column=3) |
| 184 | + |
| 185 | + |
| 186 | +lblStateTax = Label(f1, font=('arial', 16, 'bold'), text="State Tax", |
| 187 | + bd=16, anchor='w') |
| 188 | +lblStateTax.grid(row=3, column=2) |
| 189 | +txtStateTax = Entry(f1, font=('arial', 16, 'bold'), textvariable=Tax, |
| 190 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 191 | +txtStateTax.grid(row=3, column=3) |
| 192 | + |
| 193 | + |
| 194 | +lblSubTotal = Label(f1, font=('arial', 16, 'bold'), |
| 195 | + text="Sub Total", bd=16, anchor='w') |
| 196 | +lblSubTotal.grid(row=4, column=2) |
| 197 | +txtSubTotal = Entry(f1, font=('arial', 16, 'bold'), textvariable=SubTotal, |
| 198 | + bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 199 | +txtSubTotal.grid(row=4, column=3) |
| 200 | + |
| 201 | + |
| 202 | +lblTotalCost = Label(f1, font=('arial', 16, 'bold'), text="Total Cost", bd=16, anchor='w') |
| 203 | +lblTotalCost.grid(row=5, column=2) |
| 204 | +txtTotalCost = Entry(f1, font=('arial', 16, 'bold'), textvariable=Total, bd=10, insertwidth=4, bg="sky blue", justify='right') |
| 205 | +txtTotalCost.grid(row=5, column=3) |
| 206 | +# ========================================================================================================= |
| 207 | +btnTotal = Button(f1, padx=10, pady=8, bd=5, fg="black", font=('arial', 20, 'bold'), |
| 208 | + width=7, text="Total", bg="sky blue", command=Total).grid(row=7, column=1) |
| 209 | +btnReset = Button(f1, padx=10, pady=8, bd=10, fg="black", font=('arial', 20, 'bold'), |
| 210 | + width=7, text="Reset", bg="sky blue", command=Reset).grid(row=7, column=2) |
| 211 | +btnExit = Button(f1, padx=10, pady=8, bd=10, fg="black", font=('arial', 20, 'bold'), |
| 212 | + width=7, text="Exit", bg="sky blue", command=Exit).grid(row=7, column=3) |
| 213 | +root.mainloop() |
| 214 | + |
0 commit comments