SHARE
TWEET

Untitled

a guest Feb 14th, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import *
  2.  
  3. def MainMenu():
  4.     main = Tk()
  5.     main.geometry("400x200")
  6.     main.title("Main Menu")
  7.     main.resizable(True, True)
  8.  
  9.     title_frame = Frame(main)
  10.     title_frame.grid(row=0, column=0, columnspan = 2, padx=30, pady=5)
  11.     button_frame = Frame(main)
  12.     button_frame.grid(row=2, column=0, columnspan=2, padx=30, pady=5)
  13.  
  14.     Label(title_frame,text="Booking Booths System", font=('Arial',16)).grid(row=0, column=0, padx = 10,pady=20)
  15.  
  16.     login_button = Button(button_frame,text="Login",width=10, height=2,command=lambda: LoginWindow()).grid(row = 0, column = 0, pady = 5)
  17.     register_button = Button(button_frame,text="Register",width=10, height=2,command=lambda: registerWindow()).grid(row = 1, column = 0, pady = 5)
  18.  
  19.  
  20.  
  21. def LoginWindow():
  22.     global username
  23.     global password
  24.     #Window
  25.     main = Tk()
  26.     main.geometry("400x200")
  27.     main.title("Login Menu")
  28.     main.resizable(True, True)
  29.  
  30.     #Frames
  31.     title_frame = Frame(main)
  32.     title_frame.grid(row=0, column=0, columnspan = 2, padx=30, pady=5)
  33.     label_frame = Frame(main)
  34.     label_frame.grid(row=1, column=0)
  35.     entry_frame = Frame(main)
  36.     entry_frame.grid(row=1, column=1)
  37.     button_frame = Frame(main)
  38.     button_frame.grid(row=2, column=0, columnspan=2, padx=30, pady=5)
  39.  
  40.     #Labels
  41.     Label(title_frame,text="Please Enter Student Information", font=('Arial',16)).grid(row=0, column=0, padx = 10,pady=20)
  42.     Label(label_frame,text="Username").grid(row=0, column=0)
  43.     Label(label_frame,text="Password").grid(row=1, column=0)
  44.  
  45.     #Entry
  46.     username = StringVar()
  47.     password = StringVar()
  48.    
  49.     Entry(entry_frame, textvariable = username).grid(row=0, column=0)
  50.     Entry(entry_frame, textvariable = password, show = '*').grid(row=1, column=0)
  51.  
  52.     #Buttons
  53.     login_button = Button(button_frame,text="Login",width=10, height=2,command=lambda: validateLogin()).grid(row = 0, column = 0, pady = 5)
  54.  
  55. def error():
  56.     screen1 = Tk()
  57.     screen1.geometry ("200x50")
  58.     screen1.title("Warning!")
  59.     Label(screen1, text = "All fields required", fg = "red").pack()
  60.  
  61. def validateLogin():
  62.     global username
  63.     global password
  64.     username_text = username.get()
  65.     password_text = password.get()
  66.     if username_text=="" :
  67.         error()
  68.     elif password_text=="" :
  69.         error()
  70.     else:
  71.         BookingWindow()
  72. def BookingWindow():
  73.     main = Tk()
  74.     main.geometry("700x350")
  75.     main.title("Booking")
  76.     main.resizable(True, True)
  77.  
  78.     #Frames
  79.     title_frame = Frame(main)
  80.     title_frame.grid(row=0, column=0, columnspan = 5, padx=30, pady=5)
  81.     label_frame = Frame(main)
  82.     label_frame.grid(row=1, column=0)
  83.     entry_frame = Frame(main)
  84.     entry_frame.grid(row=1, column=1)
  85.     button_frame = Frame(main)
  86.     button_frame.grid(row=2, column=0, columnspan=2, padx=10, pady=5)
  87.  
  88.     #Labels
  89.     Label(title_frame, text="Booking ", font=('Arial',16)).grid(row=0, column=0, padx = 10,pady=10)
  90.     Label(label_frame, height = 2, text = "Enter Date:").grid(row=1, column=0)
  91.     Label(label_frame, text = "Time" ).grid(row=2, column =0)
  92.     Label(label_frame, text = "Period 1").grid(row=3,column=0)
  93.     Label(label_frame, text = "Period 2").grid(row=4,column=0)
  94.     Label(label_frame, text = "Break").grid(row=5,column=0)
  95.     Label(label_frame, text = "Period 3").grid(row=6,column=0)
  96.     Label(label_frame, text = "Period 4").grid(row=7,column=0)
  97.     Label(label_frame, text = "Lunch").grid(row=8,column=0)
  98.     Label(label_frame, text = "Period 5").grid(row=9,column=0)
  99.     Label(label_frame, text = "Period 6").grid(row=10,column=0)
  100.  
  101.     Label(label_frame, text = "1", width = 4).grid(row=2,column=1)
  102.     Label(label_frame, text = "2",width = 4).grid(row=2,column=2)
  103.     Label(label_frame, text = "3",width = 4).grid(row=2,column=3)
  104.     Label(label_frame, text = "4",width = 4).grid(row=2,column=4)
  105.     Label(label_frame, text = "5",width = 4).grid(row=2,column=5)
  106.     Label(label_frame, text = "6",width = 4).grid(row=2,column=6)
  107.     Label(label_frame, text = "7",width = 4).grid(row=2,column=7)
  108.     Label(label_frame, text = "8",width = 4).grid(row=2,column=8)
  109.     Label(label_frame, text = "9",width = 4).grid(row=2,column=9)
  110.     Label(label_frame, text = "10",width = 4).grid(row=2,column=10)
  111.     Label(label_frame, text = "10",width = 4).grid(row=2,column=10)
  112.     Label(label_frame, text = "10",width = 4).grid(row=2,column=10)
  113.     Label(label_frame, text = "10",width = 4).grid(row=2,column=10)
  114.    
  115.  
  116.     #Entries
  117.     day = Entry(entry_frame, width = 3).grid(row = 1, column =1, padx = 20)
  118.     month = Entry(entry_frame, width = 3).grid(row = 1, column =2,padx = 20)
  119.     year = Entry(entry_frame, width = 3).grid(row= 1,column = 3,padx = 20)
  120.  
  121.     #Checkbox
  122.    
  123.     #buttons
  124.     booth_plan_button = Button(button_frame,text="Show Booth Plan",width=15, height=2, command = boothWindow).grid(row = 1, column = 0, padx = 10, pady = 1)
  125.     confirm_button = Button(button_frame,text="Confirm Booking",width=15, height=2).grid(row = 1, column = 1, padx = 10, pady = 1)
  126.     updateTable_button = Button(button_frame,text="Update Table",width=15, height=2).grid(row = 1, column = 2, padx = 10, pady = 1)
  127.  
  128. def registerWindow():
  129.     global firstname
  130.     global surname
  131.     global registerUsername
  132.     global newPassword
  133.     global repeatPassword
  134.    
  135.  
  136.     main = Tk()
  137.     main.geometry("400x250")
  138.     main.title("Register")
  139.     main.resizable(True,True)
  140.  
  141.     #Frames
  142.     title_frame = Frame(main)
  143.     title_frame.grid(row=0, column=0, columnspan = 2, padx=30, pady=5)
  144.     label_frame = Frame(main)
  145.     label_frame.grid(row=1, column=0)
  146.     entry_frame = Frame(main)
  147.     entry_frame.grid(row=1, column=1)
  148.     button_frame = Frame(main)
  149.     button_frame.grid(row=2, column=0, columnspan=2, padx=30, pady=5)
  150.  
  151.     #Labels
  152.     Label(title_frame,text="Please Enter Student Information", font=('Arial',16)).grid(row=0, column=0, padx = 10,pady=20)
  153.     Label(label_frame,text="First Name:").grid(row=0, column=0)
  154.     Label(label_frame,text="Surname:").grid(row=1, column=0)
  155.     Label(label_frame,text="Username:").grid(row=2, column=0)
  156.     Label(label_frame,text="New Password:").grid(row=3, column=0)
  157.     Label(label_frame,text="Repeat New Password:").grid(row=4, column=0)
  158.     #Entry
  159.     firstname = StringVar()
  160.     surname = StringVar()
  161.     registerUsername = StringVar()
  162.     newPassword = StringVar()
  163.     repeatPassword = StringVar()
  164.      
  165.     Entry(entry_frame, textvariable = firstname).grid(row=0, column=0)
  166.     Entry(entry_frame, textvariable = surname).grid(row=1, column=0)
  167.     Entry(entry_frame, textvariable = registerUsername).grid(row=2, column=0)
  168.     Entry(entry_frame, textvariable = newPassword, show = '"').grid(row=3, column=0)
  169.     Entry(entry_frame, textvariable = repeatPassword, show = '"').grid(row=4,column=0)
  170.      
  171.     #Buttons
  172.     login_button = Button(button_frame,text="Register",width=10, height=2,command=lambda: validateRegister()).grid(row = 0, column = 0, pady = 5)
  173.  
  174. def validateRegister():
  175.     global firstname
  176.     global surname
  177.     global registerUsername
  178.     global newPassword
  179.     global repeatPassword
  180.    
  181.     firstname_text = firstname.get()
  182.     surname_text = surname.get()
  183.     registerUsername_text = registerUsername.get()
  184.     newPassword_text = newPassword.get()
  185.     repeatPassword_text = repeatPassword.get()
  186.    
  187.     if firstname_text == "":
  188.         error()
  189.     elif surname_text == "":
  190.         error()
  191.     elif registerUsername_text == "":
  192.         error()
  193.     elif registerUsername_text == "":
  194.         error()
  195.     elif newPassword_text == "":
  196.         error()
  197.     else:
  198.         BookingWindow()
  199.  
  200. def boothWindow():
  201.     main = Tk()
  202.     main.geometry("400x250")
  203.     main.title("Booth Plan")
  204.     main.resizable(True,True)
  205.  
  206. MainMenu()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top