Question
Create a Python program that uses a graphical user interface that will be used to order a pizza. Allow the user to enter the size
Create a Python program that uses a graphical user interface that will be used to order a pizza. Allow the user to enter the size (small, medium, large) and the toppings they want on it. When the click on the order button, Display the total cost of the pizza. Small pizza is 7.95, Medium is 9.95, Large is 13.99 Each topping is an extra .75.
TL;DR: I need help adding values to display the total. Also I did a list with multiple objects sharing same variable/value but all are selected and I have trouble adding values from sizes and each selected topping. Thank you in advance.
from tkinter import *
root = Tk()
root.title("Order Pizza")
v = IntVar()
menubar = Menu(root)
label_1 = Label(root, text="Name")
label_2 = Label(root, text="Address")
entry_1 = Entry(root)
entry_2 = Entry(root)
label_1.pack(anchor=N, side=LEFT, fill=X, expand=YES)
entry_1.pack(side=TOP, anchor=W, fill=X, expand=YES)
label_2.pack(side=LEFT,anchor=N, fill=X, expand=YES)
entry_2.pack(side=TOP, anchor=W, fill=X, expand=YES)
c = Checkbutton(root, text = "Save my order for future use")
c.pack(side=BOTTOM)
sz = Label(root, text="Select the pizza size", bg="turquoise", fg="purple")
sz.pack(side=TOP, anchor=W, expand=YES)
small = Radiobutton(root, text="Small ($7.95)", variable=v, value=7.95).pack(anchor=W)
medium = Radiobutton(root, text="Medium ($9.95)", variable=v, value=9.95).pack(anchor=W)
large = Radiobutton(root, text="Large ($13.99)", variable=v, value=13.99).pack(anchor=W)
tp = Label(root, text="Select toppings. ($0.75 each)", bg="turquoise", fg="purple")
tp.pack(anchor=W)
Toppings = ["Pepperoni", "Extra Cheese", "Olives", "Tomatoes" "Grilled chicken","Bacon"]
s = StringVar()
s.set("Toppings")
for text in Toppings:
b = Radiobutton(root, text=text, variable=0.75)
b.pack(anchor=W)
tip = Label(root, text="Tip amount").pack()
entry_3 = Entry(root).pack()
root.mainloop()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started