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

Scarlet Restaurant Order System Code

This document contains a Python script that creates a simple restaurant ordering application using Tkinter. It allows customers to enter their name, select menu items, and calculate the total bill based on their selections. The application displays error messages for missing customer names or unselected items and shows the order summary upon successful placement.

Uploaded by

kabilanan297
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Scarlet Restaurant Order System Code

This document contains a Python script that creates a simple restaurant ordering application using Tkinter. It allows customers to enter their name, select menu items, and calculate the total bill based on their selections. The application displays error messages for missing customer names or unselected items and shows the order summary upon successful placement.

Uploaded by

kabilanan297
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Source coding

import tkinter as tk
from tkinter import messagebox

# Create main window


root = [Link]()
[Link]("Scarlet Restaurant")
[Link]("400x450")

# Customer name variable


customer_name = [Link]()

# Menu items (No Database)


menu = {
"Pasta Carbonara": 250,
"Margherita Pizza": 450,
"Scarlet Special Burger": 180,
"Iced Americano": 120,
"Chicken Wings": 200,
"Cold Coffee": 110
}

item_vars = {}

# Heading
[Link](root, text="SCARLET RESTAURANT",
font=("Arial", 18, "bold"),
fg="darkred").pack(pady=10)

# Customer Name
[Link](root, text="Customer Name").pack()
[Link](root,
textvariable=customer_name).pack(pady=5)

# Menu Label
[Link](root, text="Menu", font=("Arial", 14,
"bold")).pack(pady=10)

menu_frame = [Link](root)
menu_frame.pack()

# Menu Items with Checkboxes


for item, price in [Link]():
var = [Link]()
[Link](
menu_frame,
text=f"{item} - ₹{price}",
variable=var
).pack(anchor="w")
item_vars[item] = (var, price)

# Function to calculate bill


def place_order():
name = customer_name.get()

if name == "":
[Link]("Error", "Please enter
customer name")
return
total = 0
selected_items = []

for item, (var, price) in item_vars.items():


if [Link]() == 1:
total += price
selected_items.append(item)

if total == 0:
[Link]("Error", "Please select at
least one item")
return

bill = "Customer: " + name + "\n\nItems Ordered:\n"


for item in selected_items:
bill += f"- {item}\n"

bill += f"\nTotal Bill: ₹{total}"


[Link]("Order Placed", bill)

customer_name.set("")

# Place Order Button


[Link](
root,
text="Place Order",
bg="green",
fg="white",
width=20,
height=2,
command=place_order
).pack(pady=20)

[Link]()

You might also like