Question: #import tkinter: from tkinter import * #import messagebox for displaying message: from tkinter import messagebox root = Tk ( ) root.geometry ( ' 6 2

#import tkinter:
from tkinter import *
#import messagebox for displaying message:
from tkinter import messagebox
root = Tk()
root.geometry('625x525') #Declares the size
# Assign Title and background color
root.title("Sweet Scoops")
root.configure(bg='#eb3d91')
# Header label
purchaseEntry = StringVar()
banner = Label(root, text="Sweet Scoops Ice Cream", bg="#1fe7eb", fg="blue", padx=5, pady=10, font=("Georgia",24, 'bold'))
banner.place(x=80, y=10)
# Name label and entry box
scoopLabel = Label(root, text="Enter # of Scoops Desired:", bg="white", fg="black")
scoopLabel.place(x=90, y=80)
scoopTextbox = Entry(root, width=20)
scoopTextbox.place(x=250, y=80)
# Create Flavor label:
flavorLabel = Label(root, text="Select a Flavor:", bg="white", fg="black")
flavorLabel.place(x=50, y=115)
#Create Flavor List Selection:
flavorList =["Chocolate", "Vanilla", "Strawberry"]
flavorString = StringVar()
#Create a ListBox for User to CLick on the Selected Ice Cream Flavor:
flavor = Listbox(root, width=20, height=3, listvariable=flavorString, exportselection=0)
flavor.place(x=50, y=150)
flavorString.set(flavorList)
flavor.select_set(0)
# Create Toppings label:
toppingLabel = Label(root, text="Select Toppings:", bg="white", fg="black")
toppingLabel.place(x=410, y=115)
#Create Topping List Selection For User to Select:
toppingList =["Sprinkles", "Caramel Syrup", "Chocolate Syrup", "None"]
toppingString = StringVar()
#Create a ListBox for User to CLick on the Selected Ice Cream Toppings:
toppingSides = Listbox(root, width=20, height=4, listvariable=toppingString, exportselection=0)
toppingSides.place(x=370, y=150)
toppingString.set(toppingList)
toppingSides.select_set(0)
# Total label and entry box
subtotalLabel = Label(root, text="SUBTOTAL:", bg="white", fg="black")
subtotalLabel.place(x=70, y=300)
subtotalEntry = Entry(root, width=20)
subtotalEntry.place(x=195, y=300)
# Sales Tax label and entry box
taxLabel = Label(root, text="SALES TAX:", bg="white", fg="black")
taxLabel.place(x=70, y=350)
taxEntry = Entry(root, width=20)
taxEntry.place(x=195, y=350)
# Total Cost label and entry box
totalLabel = Label(root, text="TOTAL COST:", bg="white", fg="black")
totalLabel.place(x=70, y=400)
totalEntry = Entry(root, width=20)
totalEntry.place(x=195, y=400)
# Define total and Price values for Flavor and Topping Dictionary:
def total():
flavorDict ={'Chocolate': 2.25, 'Vanilla' : 2.00, 'Strawberry': 3.00}
toppingDict ={'Sprinkles': 0.75, 'Caramel Syrup': 1.00, 'Chocolate Syrup': 1.25, 'None': 0}
#Clear out the Entry Fields for Subtotal,Tax, and Total:
subtotalEntry.delete(0, END)
taxEntry.delete(0, END)
totalEntry.delete(0, END)
#Get 1st and 2nd selctions from User:
selection1= flavor.curselection()
flavorValue = flavor.get(selection1[0])
selection2= toppingSides.curselection()
toppingValue = toppingSides.get(selection2[0])
#Loop for empty input for number of Scoops, Messagebox is displayed with message:
numberScoops = scoopTextbox.get()
if not numberScoops.isdigit():
messagebox.showinfo(title="Please enter # of ice cream scoops", message="Please enter a whole number.")
return
#Convert string to Integer:
numberScoops = int(numberScoops)
#Define Subtotal, Sales Tax, and Total Cost:
subtotal = flavorDict[flavorValue]* numberScoops + toppingDict[toppingValue]
subtotal = round(subtotal,2) #Use round function to round subtotal to (2) decimal places
salesTax = round(subtotal *0.07,2) #Use round function to round salesTax to (2) decimal places
totalCost = round(subtotal + salesTax, 2) #Use round function to round total cost to (2) decimal places
#Enter the correct formatted subtotal, salesTax, and totalCost into the entry boxes:
subtotalEntry.insert(END,"${:.2f}".format(subtotal))
taxEntry.insert(END,"${:.2f}".format(salesTax))
totalEntry.insert(END,"${:.2f}".format(totalCost))
print("Restaurant name: ", banner.cget("text"))
print("Number of Ice Cream Scoops: ", numberScoops)
print("Flavor of Ice Cream: ", flavorValue)
print("Toppings on Ice Cream: ", toppingValue)
print("-----------------------------------")
print("SubTotal: $", subtotal)
print("Sales Tax: $", salesTax)
print("Total Cost: $", totalCost)
print("Thank you for using our Sweet Scoops App! Hope to see you soon!")
#Create button for Adding user selections to find the subtotal, sales tax, and total cost:
addButton = Button(root, text="Add to the order", bg="blue", fg="black", command=total)
addButton.place(x=218, y=250)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!