# Method to set up the background image
def setup_background(self, root):
bg_width, bg_height = 800, 600
canvas = tk.Canvas(root, width=bg_width, height=bg_height)
canvas.pack()
original_image = tk.PhotoImage(file="background.png")
background_image = original_image.subsample(
original_image.width() // bg_width,
original_image.height() // bg_height
)
canvas.create_image(0, 0, anchor=tk.NW, image=background_image)
canvas.image = background_image
# Method to update the menu prices based on the selected currency
def update_menu_prices(self, *args):
currency = self.currency_var.get()
symbol = "₹" if currency == "INR" else "$"
rate = self.exchange_rate if currency == "INR" else 1
for item, label in self.menu_labels.items():
price = self.menu_items[item] * rate
label.config(text=f"{item} ({symbol}{price}):")
# Method to place an order
def place_order(self):
total_cost = 0
order_summary = "Order Summary:\n"
currency = self.currency_var.get()
symbol = "₹" if currency == "INR" else "$"
rate = self.exchange_rate if currency == "INR" else 1
for item, entry in self.menu_quantities.items():
quantity = entry.get()
if quantity.isdigit():
quantity = int(quantity)
price = self.menu_items[item] * rate
cost = quantity * price
total_cost += cost
if quantity > 0:
order_summary += (
f"{item}: {quantity} x {symbol}{price} = {symbol}{cost}\n"
)
if total_cost > 0:
order_summary += f"\nTotal Cost: {symbol}{total_cost}"
messagebox.showinfo("Order Placed", order_summary)
else:
messagebox.showerror("Error", "Please order at least one item.")
# Main block to run the app
if __name__ == "__main__":
root = tk.Tk()
app = RestaurantOrderManagement(root)
root.geometry("800x600") # Set the size of the window
root.mainloop() # Start the GUI loop
To embed this project on your website, copy the following code and paste it into your website's HTML: