Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import ttk
- from tkinter import font
- from datetime import datetime,time
- from MenuItems import *
- import time
- # click and unclick for window and back
- def click(window):
- window()
- def unclick(window):
- root.lift(window)
- window.destroy()
- root = tk.Tk()
- root.title("North Spine Canteen App")
- root.state("zoomed")
- background_image = tk.PhotoImage(file = "food.png")
- background_label = tk.Label(root, image = background_image)
- background_label.place(x = 0, y = 0, relheight = 1.0, relwidth = 1.0)
- welcomelabel = tk.Label(background_label, text = "Welcome to the North Spine Canteen App", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 40))
- welcomelabel.place(relwidth = 0.5, relheight = 0.2, relx = 0.25, rely = 0.2)
- optionlabel = tk.Label(background_label, text = "Select stores here:", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 35))
- optionlabel.place(relwidth = 0.5, relheight = 0.2, relx = 0.25, rely = 0.4)
- # current date and time function
- now = datetime.now()
- current_date = now.strftime("%B %d, %Y %H:%M:%S" )
- current_time = datetime.now()
- weekday = current_time.strftime('%A')
- # get queue time function
- def get_queue_time(queue_entry):
- try:
- queue_time = int(queue_entry)*2
- queue_time_output['text'] = 'The estimated queue time is: ' + str(queue_time) + ' min'
- except:
- queue_time_output['text'] = 'please key in integer only'
- def checktime1():
- try:
- day = int(DD.get())
- month = int(MM.get())
- year = int(YYYY.get())
- hour = int(hr.get())
- minute = int(min.get())
- day = datetime(year, month, day).weekday()
- if (hour <= 8 and minute < 30) or (hour >= 22 and minute > 30):
- special_meal_of_day['text'] = 'Canteen is Closed. Canteen opens from 08:30am to 10:30pm'
- else:
- special_meal_of_day['text'] = date_special_meal1(day)
- except ValueError:
- special_meal_of_day['text'] = 'Please key in integers only and in DD/MM/YYYY Hr/Min format'
- def checktime2():
- try:
- day = int(DD.get())
- month = int(MM.get())
- year = int(YYYY.get())
- hour = int(hr.get())
- minute = int(min.get())
- day = datetime(year, month, day).weekday()
- if (hour <= 8 and minute < 30) or (hour >= 22 and minute > 30):
- special_meal_of_day['text'] = 'Canteen is Closed. Canteen opens from 08:30am to 10:30pm'
- else:
- special_meal_of_day['text'] = date_special_meal2(day)
- except ValueError:
- special_meal_of_day['text'] = 'Please key in integers only and in DD/MM/YYYY Hr/Min format'
- def checktime3():
- try:
- day = int(DD.get())
- month = int(MM.get())
- year = int(YYYY.get())
- hour = int(hr.get())
- minute = int(min.get())
- day = datetime(year, month, day).weekday()
- if (hour <= 8 and minute < 30) or (hour >= 22 and minute > 30):
- special_meal_of_day['text'] = 'Canteen is Closed. Canteen opens from 08:30am to 10:30pm'
- else:
- special_meal_of_day['text'] = date_special_meal3(day)
- except ValueError:
- special_meal_of_day['text'] = 'Please key in integers only and in DD/MM/YYYY Hr/Min format'
- def checktime4():
- try:
- day = int(DD.get())
- month = int(MM.get())
- year = int(YYYY.get())
- hour = int(hr.get())
- minute = int(min.get())
- day = datetime(year, month, day).weekday()
- if (hour <= 8 and minute < 30) or (hour >= 22 and minute > 30):
- special_meal_of_day['text'] = 'Canteen is Closed. Canteen opens from 08:30am to 10:30pm'
- else:
- special_meal_of_day['text'] = date_special_meal4(day)
- except ValueError:
- special_meal_of_day['text'] = 'Please key in integers only and in DD/MM/YYYY Hr/Min format'
- def checktime5():
- try:
- day = int(DD.get())
- month = int(MM.get())
- year = int(YYYY.get())
- hour = int(hr.get())
- minute = int(min.get())
- day = datetime(year, month, day).weekday()
- if (hour == 7 and minute == 00) or (hour < 7):
- special_meal_of_day['text'] = 'MacDonalds is Closed. MacDonalds opens from 07:00am to 12:00am'
- else:
- special_meal_of_day['text'] = date_hr_special_meal5(day,hour)
- except ValueError:
- special_meal_of_day['text'] = 'Please key in integers only and in DD/MM/YYYY Hr/Min format'
- time1_w = ''
- def tick_window():
- global time1_w
- # get the current local time from the PC
- time2_w = time.strftime('%B %d, %Y %H:%M:%S')
- # if time string has changed, update it
- if time2_w != time1:
- time1_w = time2_w
- clock.config(text=time2_w)
- # calls itself every 200 milliseconds
- # to update the time display as needed
- # could use >200 ms, but display gets jerky
- clock.after(200, tick_window)
- date_label['text'] = time2_w
- time1 = ''
- def tick():
- global time1
- # get the current local time from the PC
- time2 = time.strftime('%B %d, %Y %H:%M:%S')
- # if time string has changed, update it
- if time2 != time1:
- time1 = time2
- clock.config(text=time2)
- # calls itself every 200 milliseconds
- # to update the time display as needed
- # could use >200 ms, but display gets jerky
- clock.after(200, tick)
- clock = tk.Label(root, text = current_date, fg ='white', bg='black')
- clock.place(relwidth = 1.0, relheight = 0.05, relx = 0.0, rely = 0.95)
- tick()
- def window1():
- window1 = tk.Toplevel(root)
- window1.title("Vegetarian Food")
- window1.state("withdrawn")
- # picture of store
- pic1_image = tk.PhotoImage(file = "Veg stall.png")
- background_label1 = tk.Label(window1, image=pic1_image)
- background_label1.place(relwidth = 0.5, relheight = 0.55, relx = 0.05, rely = 0.02)
- background_label1.image=pic1_image
- # queue frame with functions
- queue_frame = tk.Frame(window1, bg = "black")
- queue_frame.place(relheight = 0.4, relwidth = 0.4, relx = 0.55, rely = 0.0)
- wait_label = tk.Label(queue_frame, text = "WAIT TIME CALCULATOR", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- wait_label.place(relheight = 0.2, relwidth = 0.7, relx = 0.2, rely = 0.0)
- queue_label = tk.Label(queue_frame, text = "Enter no. of pax in queue: ", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- queue_label.place(relheight = 0.2, relwidth = 0.5, relx = 0.0, rely = 0.2)
- queue_entry = tk.Entry(queue_frame, bg = "white", fg = "black")
- queue_entry.place(relheight = 0.1, relwidth = 0.4, relx = 0.1, rely = 0.4)
- queue_button = tk.Button(queue_frame, text = "Calculate", fg = "black", bg = "orange", command=lambda : get_queue_time(queue_entry.get()))
- queue_button.place(relheight = 0.1, relwidth = 0.3, relx = 0.6, rely = 0.4)
- global queue_time_output
- queue_time_output = tk.Label(queue_frame, bg = 'white', fg = 'black')
- queue_time_output.place(relheight = 0.2, relwidth = 0.8, relx = 0.5, rely = 0.6, anchor = 'n')
- # bottom date time box with funtions
- global date_label
- date_label = tk.Label(window1, text = current_date, fg = "white", bg = "black" )
- date_label.place(relheight = 0.05, relwidth = 1, relx = 0.0, rely = 0.95)
- tick_window()
- # special meal box according to date
- special_meal_frame = tk.Frame(window1, bg = "black")
- special_meal_frame.place(relheight = 0.2, relwidth = 0.47, relx = 0.05, rely = 0.7)
- special_meal_title = tk.Label(special_meal_frame, text = 'Meal of the Day', fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- special_meal_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.3, rely = 0.0)
- #Vegetarian Food Special Meal
- global special_meal_of_day
- special_meal_of_day = tk.Label(special_meal_frame, bg = 'black', fg = 'white', text = weekday + ' : ' + special_meal1(weekday.upper()))
- special_meal_of_day.place(relheight = 0.3, relwidth = 1, relx = 0.5, rely = 0.35, anchor = 'n')
- # menu frame with contents
- normal_menu_frame = tk.Frame(window1, bg = "black")
- normal_menu_frame.place(relheight = 0.45, relwidth = 0.4, relx = 0.55, rely = 0.45)
- normal_menu_title = tk.Label(normal_menu_frame, text = "MENU", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- normal_menu_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.35, rely = 0.0)
- normal_menu1 = tk.Label(normal_menu_frame, text = "White Rice \n\n Brown Rice \n\n Bee Hoon \n\n Fried Rice \n\n Vegetable \n\n Vegetarian Meat \n\n Hor Fun/Crispy Noodle", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu1.place(relheight = 0.8, relwidth = 0.4, relx = 0.1, rely = 0.2)
- normal_menu_price = tk.Label(normal_menu_frame, text = "$0.50 \n\n $0.80 \n\n $1.00 \n\n $1.00 \n\n $0.70 \n\n $1.00 \n\n $3.00/$4.00", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu_price.place(relheight = 0.8, relwidth = 0.4, relx = 0.6, rely = 0.2)
- #Frame for user input time and date###################################################################################################
- timeframe = tk.Frame(window1, bg= "black")
- timeframe.place(relheight = 0.1, relwidth = 0.47, relx = 0.05, rely = 0.58)
- datelabel = tk.Label(timeframe, text = "Date:", fg = "white", bg = "black" )
- datelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.2, rely = 0.35)
- global DD
- DD = tk.Entry(timeframe, bg = 'white', fg = 'black')
- DD.insert(0, 'DD')
- DD.place(relheight = 0.3, relwidth = 0.05, relx = 0.3, rely = 0.35)
- global MM
- MM = tk.Entry(timeframe, bg = 'white', fg = 'black')
- MM.insert(0, 'MM')
- MM.place(relheight = 0.3, relwidth = 0.05, relx = 0.37, rely = 0.35)
- global YYYY
- YYYY = tk.Entry(timeframe, bg = 'white', fg = 'black')
- YYYY.insert(0, 'YYYY')
- YYYY.place(relheight = 0.3, relwidth = 0.07, relx = 0.44, rely = 0.35)
- timelabel = tk.Label(timeframe, text = "Time:", fg = "white", bg = "black" )
- timelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.6, rely = 0.35)
- tk.Label(timeframe, text = ":", fg = "white", bg = "black" ).place(relheight = 0.15, relwidth = 0.05, relx = 0.735, rely = 0.4)
- global hr
- hr = tk.Entry(timeframe, bg = 'white', fg = 'black')
- hr.insert(0, 'hr')
- hr.place(relheight = 0.3, relwidth = 0.05, relx = 0.7, rely = 0.35)
- global min
- min = tk.Entry(timeframe, bg = 'white', fg = 'black')
- min.insert(0, 'min')
- min.place(relheight = 0.3, relwidth = 0.05, relx = 0.77, rely = 0.35)
- checkbutton = tk.Button(timeframe, text = "Check", command = lambda : checktime1()).place(relheight = 0.3, relwidth = 0.1, relx = 0.88, rely = 0.35)
- ####################################################################################################################################
- window1.lift(root)
- window1.state("normal")
- window1.state("zoomed")
- button1a = tk.Button(window1, text = "Back", command=lambda : unclick(window1))
- button1a.place(relwidth = 0.05, relheight = 0.1, relx = 0, rely = 0)
- def window2():
- window2 = tk.Toplevel(root)
- window2.title("Mini Wok")
- window2.state("withdrawn")
- # picture of store
- pic2_image = tk.PhotoImage(file = "Mini Wok.png")
- background_label2 = tk.Label(window2, image=pic2_image)
- background_label2.place(relwidth = 0.5, relheight = 0.55, relx = 0.05, rely = 0.02)
- background_label2.image=pic2_image
- # queue frame with functions
- queue_frame = tk.Frame(window2, bg = "black")
- queue_frame.place(relheight = 0.4, relwidth = 0.4, relx = 0.55, rely = 0.0)
- wait_label = tk.Label(queue_frame, text = "WAIT TIME CALCULATOR", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- wait_label.place(relheight = 0.2, relwidth = 0.7, relx = 0.2, rely = 0.0)
- queue_label = tk.Label(queue_frame, text = "Enter no. of pax in queue: ", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- queue_label.place(relheight = 0.2, relwidth = 0.5, relx = 0.0, rely = 0.2)
- queue_entry = tk.Entry(queue_frame, bg = "white", fg = "black")
- queue_entry.place(relheight = 0.1, relwidth = 0.4, relx = 0.1, rely = 0.4)
- queue_button = tk.Button(queue_frame, text = "Calculate", fg = "black", bg = "orange", command=lambda : get_queue_time(queue_entry.get()))
- queue_button.place(relheight = 0.1, relwidth = 0.3, relx = 0.6, rely = 0.4)
- global queue_time_output
- queue_time_output = tk.Label(queue_frame, bg = 'white', fg = 'black')
- queue_time_output.place(relheight = 0.2, relwidth = 0.8, relx = 0.5, rely = 0.6, anchor = 'n')
- # bottom date time box with funtions
- global date_label
- date_label = tk.Label(window2, text = current_date, fg = "white", bg = "black" )
- date_label.place(relheight = 0.05, relwidth = 1, relx = 0.0, rely = 0.95)
- tick_window()
- # special meal box according to date
- special_meal_frame = tk.Frame(window2, bg = "black")
- special_meal_frame.place(relheight = 0.2, relwidth = 0.47, relx = 0.05, rely = 0.7)
- special_meal_title = tk.Label(special_meal_frame, text = 'Meal of the Day', fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- special_meal_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.3, rely = 0.0)
- global special_meal_of_day
- special_meal_of_day = tk.Label(special_meal_frame, bg = 'black', fg = 'white', text = weekday + ' : ' + special_meal2(weekday.upper()))
- special_meal_of_day.place(relheight = 0.3, relwidth = 1, relx = 0.5, rely = 0.35, anchor = 'n')
- # menu frame with contents
- normal_menu_frame = tk.Frame(window2, bg = "black")
- normal_menu_frame.place(relheight = 0.45, relwidth = 0.4, relx = 0.55, rely = 0.45)
- normal_menu_title = tk.Label(normal_menu_frame, text = "MENU", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- normal_menu_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.35, rely = 0.0)
- normal_menu1 = tk.Label(normal_menu_frame, text = "Chicken Fried Rice \n\n Fried Rice with Fillet \n\n Fried Rice with Prawn \n\n Pan Fried Chicken Rice \n\n Sambal Fish Fillet Rice \n\n Mixed Veg Toufu \n\n Kung Bao Chicken Rice", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu1.place(relheight = 0.8, relwidth = 0.4, relx = 0.1, rely = 0.2)
- normal_menu_price = tk.Label(normal_menu_frame, text = "$3.80 \n\n $3.80 \n\n $3.80 \n\n $4.20 \n\n $4.20 \n\n $4.00 \n\n $4.20", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu_price.place(relheight = 0.8, relwidth = 0.4, relx = 0.6, rely = 0.2)
- #Frame for user input time and date###################################################################################################
- timeframe = tk.Frame(window2, bg= "black")
- timeframe.place(relheight = 0.1, relwidth = 0.47, relx = 0.05, rely = 0.58)
- datelabel = tk.Label(timeframe, text = "Date:", fg = "white", bg = "black" )
- datelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.2, rely = 0.35)
- global DD
- DD = tk.Entry(timeframe, bg = 'white', fg = 'black')
- DD.insert(0, 'DD')
- DD.place(relheight = 0.3, relwidth = 0.05, relx = 0.3, rely = 0.35)
- global MM
- MM = tk.Entry(timeframe, bg = 'white', fg = 'black')
- MM.insert(0, 'MM')
- MM.place(relheight = 0.3, relwidth = 0.05, relx = 0.37, rely = 0.35)
- global YYYY
- YYYY = tk.Entry(timeframe, bg = 'white', fg = 'black')
- YYYY.insert(0, 'YYYY')
- YYYY.place(relheight = 0.3, relwidth = 0.07, relx = 0.44, rely = 0.35)
- timelabel = tk.Label(timeframe, text = "Time:", fg = "white", bg = "black" )
- timelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.6, rely = 0.35)
- tk.Label(timeframe, text = ":", fg = "white", bg = "black" ).place(relheight = 0.15, relwidth = 0.05, relx = 0.735, rely = 0.4)
- global hr
- hr = tk.Entry(timeframe, bg = 'white', fg = 'black')
- hr.insert(0, 'hr')
- hr.place(relheight = 0.3, relwidth = 0.05, relx = 0.7, rely = 0.35)
- global min
- min = tk.Entry(timeframe, bg = 'white', fg = 'black')
- min.insert(0, 'min')
- min.place(relheight = 0.3, relwidth = 0.05, relx = 0.77, rely = 0.35)
- checkbutton = tk.Button(timeframe, text = "Check", command = lambda : checktime2()).place(relheight = 0.3, relwidth = 0.1, relx = 0.88, rely = 0.35)
- ####################################################################################################################################
- window2.lift(root)
- window2.state("normal")
- window2.state("zoomed")
- button2a = tk.Button(window2, text = "Back", command=lambda : unclick(window2))
- button2a.place(relwidth = 0.05, relheight = 0.1, relx = 0, rely = 0)
- #Chicken Rice
- def window3():
- window3 = tk.Toplevel(root)
- window3.title("Chicken Rice")
- window3.state("withdrawn")
- # picture of store
- pic3_image = tk.PhotoImage(file = "Chicken Rice.png")
- background_label3 = tk.Label(window3, image=pic3_image)
- background_label3.place(relwidth = 0.5, relheight = 0.55, relx = 0.05, rely = 0.02)
- background_label3.image=pic3_image
- # queue frame with functions
- queue_frame = tk.Frame(window3, bg = "black")
- queue_frame.place(relheight = 0.4, relwidth = 0.4, relx = 0.55, rely = 0.0)
- wait_label = tk.Label(queue_frame, text = "WAIT TIME CALCULATOR", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- wait_label.place(relheight = 0.2, relwidth = 0.7, relx = 0.2, rely = 0.0)
- queue_label = tk.Label(queue_frame, text = "Enter no. of pax in queue: ", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- queue_label.place(relheight = 0.2, relwidth = 0.5, relx = 0.0, rely = 0.2)
- queue_entry = tk.Entry(queue_frame, bg = "white", fg = "black")
- queue_entry.place(relheight = 0.1, relwidth = 0.4, relx = 0.1, rely = 0.4)
- queue_button = tk.Button(queue_frame, text = "Calculate", fg = "black", bg = "orange", command=lambda : get_queue_time(queue_entry.get()))
- queue_button.place(relheight = 0.1, relwidth = 0.3, relx = 0.6, rely = 0.4)
- global queue_time_output
- queue_time_output = tk.Label(queue_frame, bg = 'white', fg = 'black')
- queue_time_output.place(relheight = 0.2, relwidth = 0.8, relx = 0.5, rely = 0.6, anchor = 'n')
- # bottom date time box with funtions
- global date_label
- date_label = tk.Label(window3, text = current_date, fg = "white", bg = "black" )
- date_label.place(relheight = 0.05, relwidth = 1, relx = 0.0, rely = 0.95)
- tick_window()
- # special meal box according to date
- special_meal_frame = tk.Frame(window3, bg = "black")
- special_meal_frame.place(relheight = 0.2, relwidth = 0.47, relx = 0.05, rely = 0.7)
- special_meal_title = tk.Label(special_meal_frame, text = 'Meal of the Day', fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- special_meal_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.3, rely = 0.0)
- global special_meal_of_day
- special_meal_of_day = tk.Label(special_meal_frame, bg = 'black', fg = 'white', text = weekday + ' : ' + special_meal3(weekday.upper()))
- special_meal_of_day.place(relheight = 0.3, relwidth = 1, relx = 0.5, rely = 0.35, anchor = 'n')
- # menu frame with contents
- normal_menu_frame = tk.Frame(window3, bg = "black")
- normal_menu_frame.place(relheight = 0.45, relwidth = 0.4, relx = 0.55, rely = 0.45)
- normal_menu_title = tk.Label(normal_menu_frame, text = "MENU", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- normal_menu_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.35, rely = 0.0)
- normal_menu1 = tk.Label(normal_menu_frame, text = "Steamed Chicken Rice\n\n Steamed Chicken Rice Set \n\n Roasted Chicken Rice \n\n Lemon Chicken Rice \n\n Curry Chicken Noodle \n\n Soya Sauce Veg \n\n Thai Style Beancurd", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu1.place(relheight = 0.8, relwidth = 0.4, relx = 0.1, rely = 0.2)
- normal_menu_price = tk.Label(normal_menu_frame, text = "$3.00 \n\n $4.50 \n\n $3.00 \n\n $3.00 \n\n $3.00 \n\n $2.00 \n\n $2.00", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu_price.place(relheight = 0.8, relwidth = 0.4, relx = 0.6, rely = 0.2)
- #Frame for user input time and date###################################################################################################
- timeframe = tk.Frame(window3, bg= "black")
- timeframe.place(relheight = 0.1, relwidth = 0.47, relx = 0.05, rely = 0.58)
- datelabel = tk.Label(timeframe, text = "Date:", fg = "white", bg = "black" )
- datelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.2, rely = 0.35)
- global DD
- DD = tk.Entry(timeframe, bg = 'white', fg = 'black')
- DD.insert(0, 'DD')
- DD.place(relheight = 0.3, relwidth = 0.05, relx = 0.3, rely = 0.35)
- global MM
- MM = tk.Entry(timeframe, bg = 'white', fg = 'black')
- MM.insert(0, 'MM')
- MM.place(relheight = 0.3, relwidth = 0.05, relx = 0.37, rely = 0.35)
- global YYYY
- YYYY = tk.Entry(timeframe, bg = 'white', fg = 'black')
- YYYY.insert(0, 'YYYY')
- YYYY.place(relheight = 0.3, relwidth = 0.07, relx = 0.44, rely = 0.35)
- timelabel = tk.Label(timeframe, text = "Time:", fg = "white", bg = "black" )
- timelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.6, rely = 0.35)
- tk.Label(timeframe, text = ":", fg = "white", bg = "black" ).place(relheight = 0.15, relwidth = 0.05, relx = 0.735, rely = 0.4)
- global hr
- hr = tk.Entry(timeframe, bg = 'white', fg = 'black')
- hr.insert(0, 'hr')
- hr.place(relheight = 0.3, relwidth = 0.05, relx = 0.7, rely = 0.35)
- global min
- min = tk.Entry(timeframe, bg = 'white', fg = 'black')
- min.insert(0, 'min')
- min.place(relheight = 0.3, relwidth = 0.05, relx = 0.77, rely = 0.35)
- checkbutton = tk.Button(timeframe, text = "Check", command = lambda : checktime3()).place(relheight = 0.3, relwidth = 0.1, relx = 0.88, rely = 0.35)
- ####################################################################################################################################
- window3.lift(root)
- window3.state("normal")
- window3.state("zoomed")
- button3a = tk.Button(window3, text = "Back", command=lambda : unclick(window3))
- button3a.place(relwidth = 0.05, relheight = 0.1, relx = 0, rely = 0)
- def window4():
- window4 = tk.Toplevel(root)
- window4.title("Handmade Noodles")
- window4.state("withdrawn")
- # picture of store
- pic4_image = tk.PhotoImage(file = "Handmade Noodle.png")
- background_label4 = tk.Label(window4, image=pic4_image)
- background_label4.place(relwidth = 0.5, relheight = 0.55, relx = 0.05, rely = 0.02)
- background_label4.image=pic4_image
- # queue frame with functions
- queue_frame = tk.Frame(window4, bg = "black")
- queue_frame.place(relheight = 0.4, relwidth = 0.4, relx = 0.55, rely = 0.0)
- wait_label = tk.Label(queue_frame, text = "WAIT TIME CALCULATOR", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- wait_label.place(relheight = 0.2, relwidth = 0.7, relx = 0.2, rely = 0.0)
- queue_label = tk.Label(queue_frame, text = "Enter no. of pax in queue: ", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- queue_label.place(relheight = 0.2, relwidth = 0.5, relx = 0.0, rely = 0.2)
- queue_entry = tk.Entry(queue_frame, bg = "white", fg = "black")
- queue_entry.place(relheight = 0.1, relwidth = 0.4, relx = 0.1, rely = 0.4)
- queue_button = tk.Button(queue_frame, text = "Calculate", fg = "black", bg = "orange", command=lambda : get_queue_time(queue_entry.get()))
- queue_button.place(relheight = 0.1, relwidth = 0.3, relx = 0.6, rely = 0.4)
- global queue_time_output
- queue_time_output = tk.Label(queue_frame, bg = 'white', fg = 'black')
- queue_time_output.place(relheight = 0.2, relwidth = 0.8, relx = 0.5, rely = 0.6, anchor = 'n')
- # bottom date time box with funtions
- global date_label
- date_label = tk.Label(window4, text = current_date, fg = "white", bg = "black" )
- date_label.place(relheight = 0.05, relwidth = 1, relx = 0.0, rely = 0.95)
- tick_window()
- # special meal box according to date
- special_meal_frame = tk.Frame(window4, bg = "black")
- special_meal_frame.place(relheight = 0.2, relwidth = 0.47, relx = 0.05, rely = 0.7)
- special_meal_title = tk.Label(special_meal_frame, text = 'Meal of the Day', fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- special_meal_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.3, rely = 0.0)
- global special_meal_of_day
- special_meal_of_day = tk.Label(special_meal_frame, bg = 'black', fg = 'white', text = weekday + ' : ' + special_meal4(weekday.upper()))
- special_meal_of_day.place(relheight = 0.3, relwidth = 1, relx = 0.5, rely = 0.35, anchor = 'n')
- # menu frame with contents
- normal_menu_frame = tk.Frame(window4, bg = "black")
- normal_menu_frame.place(relheight = 0.45, relwidth = 0.4, relx = 0.55, rely = 0.45)
- normal_menu_title = tk.Label(normal_menu_frame, text = "MENU", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- normal_menu_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.35, rely = 0.0)
- normal_menu1 = tk.Label(normal_menu_frame, text = "U Mian \n\n Mee Sua \n\n Thin Bee Hoon \n\n Dumpling Ban Mian \n\n Tom Yam Ban Mian \n\n Spicy & Sour Noodle \n\n Zha Jiang Mian", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu1.place(relheight = 0.8, relwidth = 0.4, relx = 0.1, rely = 0.2)
- normal_menu_price = tk.Label(normal_menu_frame, text = "$3.00 \n\n $3.00 \n\n $3.00 \n\n $3.50 \n\n $3.80 \n\n $3.50 \n\n $3.50", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu_price.place(relheight = 0.8, relwidth = 0.4, relx = 0.6, rely = 0.2)
- #Frame for user input time and date###################################################################################################
- timeframe = tk.Frame(window4, bg= "black")
- timeframe.place(relheight = 0.1, relwidth = 0.47, relx = 0.05, rely = 0.58)
- datelabel = tk.Label(timeframe, text = "Date:", fg = "white", bg = "black" )
- datelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.2, rely = 0.35)
- global DD
- DD = tk.Entry(timeframe, bg = 'white', fg = 'black')
- DD.insert(0, 'DD')
- DD.place(relheight = 0.3, relwidth = 0.05, relx = 0.3, rely = 0.35)
- global MM
- MM = tk.Entry(timeframe, bg = 'white', fg = 'black')
- MM.insert(0, 'MM')
- MM.place(relheight = 0.3, relwidth = 0.05, relx = 0.37, rely = 0.35)
- global YYYY
- YYYY = tk.Entry(timeframe, bg = 'white', fg = 'black')
- YYYY.insert(0, 'YYYY')
- YYYY.place(relheight = 0.3, relwidth = 0.07, relx = 0.44, rely = 0.35)
- timelabel = tk.Label(timeframe, text = "Time:", fg = "white", bg = "black" )
- timelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.6, rely = 0.35)
- tk.Label(timeframe, text = ":", fg = "white", bg = "black" ).place(relheight = 0.15, relwidth = 0.05, relx = 0.735, rely = 0.4)
- global hr
- hr = tk.Entry(timeframe, bg = 'white', fg = 'black')
- hr.insert(0, 'hr')
- hr.place(relheight = 0.3, relwidth = 0.05, relx = 0.7, rely = 0.35)
- global min
- min = tk.Entry(timeframe, bg = 'white', fg = 'black')
- min.insert(0, 'min')
- min.place(relheight = 0.3, relwidth = 0.05, relx = 0.77, rely = 0.35)
- checkbutton = tk.Button(timeframe, text = "Check", command = lambda : checktime4()).place(relheight = 0.3, relwidth = 0.1, relx = 0.88, rely = 0.35)
- ####################################################################################################################################
- window4.lift(root)
- window4.state("normal")
- window4.state("zoomed")
- button4a = tk.Button(window4, text = "Back", command=lambda : unclick(window4))
- button4a.place(relwidth = 0.05, relheight = 0.1, relx = 0, rely = 0)
- def window5():
- window5 = tk.Toplevel(root)
- window5.title("McDonald's")
- window5.state("withdrawn")
- # picture of store
- pic5_image = tk.PhotoImage(file = "McDonald's.png")
- background_label5 = tk.Label(window5, image=pic5_image)
- background_label5.place(relwidth = 0.5, relheight = 0.55, relx = 0.05, rely = 0.02)
- background_label5.image=pic5_image
- # queue frame with functions
- queue_frame = tk.Frame(window5, bg = "black")
- queue_frame.place(relheight = 0.4, relwidth = 0.4, relx = 0.55, rely = 0.0)
- wait_label = tk.Label(queue_frame, text = "WAIT TIME CALCULATOR", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- wait_label.place(relheight = 0.2, relwidth = 0.7, relx = 0.2, rely = 0.0)
- queue_label = tk.Label(queue_frame, text = "Enter no. of pax in queue: ", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- queue_label.place(relheight = 0.2, relwidth = 0.5, relx = 0.0, rely = 0.2)
- queue_entry = tk.Entry(queue_frame, bg = "white", fg = "black")
- queue_entry.place(relheight = 0.1, relwidth = 0.4, relx = 0.1, rely = 0.4)
- queue_button = tk.Button(queue_frame, text = "Calculate", fg = "black", bg = "orange", command=lambda : get_queue_time(queue_entry.get()))
- queue_button.place(relheight = 0.1, relwidth = 0.3, relx = 0.6, rely = 0.4)
- global queue_time_output
- queue_time_output = tk.Label(queue_frame, bg = 'white', fg = 'black')
- queue_time_output.place(relheight = 0.2, relwidth = 0.8, relx = 0.5, rely = 0.6, anchor = 'n')
- # bottom date time box with funtions
- global date_label
- date_label = tk.Label(window5, text = current_date, fg = "white", bg = "black" )
- date_label.place(relheight = 0.05, relwidth = 1, relx = 0.0, rely = 0.95)
- tick_window()
- # special meal box according to date
- special_meal_frame = tk.Frame(window5, bg = "black")
- special_meal_frame.place(relheight = 0.2, relwidth = 0.47, relx = 0.05, rely = 0.7)
- special_meal_title = tk.Label(special_meal_frame, text = 'Meal of the Day', fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- special_meal_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.3, rely = 0.0)
- global special_meal_of_day
- special_meal_of_day = tk.Label(special_meal_frame, bg = 'black', fg = 'white', text = weekday + ' : ' + special_meal5(weekday.upper()))
- special_meal_of_day.place(relheight = 0.3, relwidth = 1, relx = 0.5, rely = 0.35, anchor = 'n')
- # menu frame with contents
- normal_menu_frame = tk.Frame(window5, bg = "black")
- normal_menu_frame.place(relheight = 0.45, relwidth = 0.4, relx = 0.55, rely = 0.45)
- normal_menu_title = tk.Label(normal_menu_frame, text = "MENU", fg = "white", bg = "black", font = ("Gill Sans MT Ext Condensed Bold", 20))
- normal_menu_title.place(relheight = 0.2, relwidth = 0.4, relx = 0.35, rely = 0.0)
- normal_menu1 = tk.Label(normal_menu_frame, text = "Fillet O Fish \n\n Double Fillet O Fish \n\n Big Mac \n\n McSpicy \n\n Double McSpicy \n\n McWings (4 pcs) \n\n McChicken", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu1.place(relheight = 0.8, relwidth = 0.4, relx = 0.1, rely = 0.2)
- normal_menu_price = tk.Label(normal_menu_frame, text = "$2.50 \n\n $5.80 \n\n $5.60 \n\n $5.25 \n\n $7.20 \n\n $4.00 \n\n $2.00", fg = "white", bg = "black", font = ("Times New Roman", 10))
- normal_menu_price.place(relheight = 0.8, relwidth = 0.4, relx = 0.6, rely = 0.2)
- #Frame for user input time and date###################################################################################################
- timeframe = tk.Frame(window5, bg= "black")
- timeframe.place(relheight = 0.1, relwidth = 0.47, relx = 0.05, rely = 0.58)
- datelabel = tk.Label(timeframe, text = "Date:", fg = "white", bg = "black" )
- datelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.2, rely = 0.35)
- global DD
- DD = tk.Entry(timeframe, bg = 'white', fg = 'black')
- DD.insert(0, 'DD')
- DD.place(relheight = 0.3, relwidth = 0.05, relx = 0.3, rely = 0.35)
- global MM
- MM = tk.Entry(timeframe, bg = 'white', fg = 'black')
- MM.insert(0, 'MM')
- MM.place(relheight = 0.3, relwidth = 0.05, relx = 0.37, rely = 0.35)
- global YYYY
- YYYY = tk.Entry(timeframe, bg = 'white', fg = 'black')
- YYYY.insert(0, 'YYYY')
- YYYY.place(relheight = 0.3, relwidth = 0.07, relx = 0.44, rely = 0.35)
- timelabel = tk.Label(timeframe, text = "Time:", fg = "white", bg = "black" )
- timelabel.place(relheight = 0.35, relwidth = 0.1, relx = 0.6, rely = 0.35)
- tk.Label(timeframe, text = ":", fg = "white", bg = "black" ).place(relheight = 0.15, relwidth = 0.05, relx = 0.735, rely = 0.4)
- global hr
- hr = tk.Entry(timeframe, bg = 'white', fg = 'black')
- hr.insert(0, 'hr')
- hr.place(relheight = 0.3, relwidth = 0.05, relx = 0.7, rely = 0.35)
- global min
- min = tk.Entry(timeframe, bg = 'white', fg = 'black')
- min.insert(0, 'min')
- min.place(relheight = 0.3, relwidth = 0.05, relx = 0.77, rely = 0.35)
- checkbutton = tk.Button(timeframe, text = "Check", command = lambda : checktime5()).place(relheight = 0.3, relwidth = 0.1, relx = 0.88, rely = 0.35)
- ####################################################################################################################################
- window5.lift(root)
- window5.state("normal")
- window5.state("zoomed")
- button5a = tk.Button(window5, text = "Back", command=lambda : unclick(window5))
- button5a.place(relwidth = 0.05, relheight = 0.1, relx = 0, rely = 0)
- # Buttons
- button1 = tk.Button(root, text = "Vegetarian Food", command=lambda : click(window1))
- button1.place(relwidth = 0.1, relheight = 0.1, relx = 0.25, rely = 0.6)
- button2 = tk.Button(root, text = "Mini Wok", command=lambda : click(window2))
- button2.place(relwidth = 0.1, relheight = 0.1, relx = 0.35, rely = 0.6)
- button3 = tk.Button(root, text = "Chicken Rice", command=lambda : click(window3))
- button3.place(relwidth = 0.1, relheight = 0.1, relx = 0.45, rely = 0.6)
- button4 = tk.Button(root, text = "Handmade Noodle", command=lambda : click(window4))
- button4.place(relwidth = 0.1, relheight = 0.1, relx = 0.55, rely = 0.6)
- button5 = tk.Button(root, text = "McDonald's", command=lambda : click(window5))
- button5.place(relwidth = 0.1, relheight = 0.1, relx = 0.65, rely = 0.6)
- canteen_information = ('Operating hours: 8.30-10.30pm \n 76 Nanyang Drive, Singapore 637331 Nanyang Drive, Singapore 637331')
- label_canteen = tk.Label(root, text = canteen_information, bg = 'black', fg = 'white', font = ("Gill Sans MT Ext Condensed Bold", 20))
- label_canteen.place(relwidth = 0.4, relheight = 0.1, relx = 0.3 , rely = 0.7)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement