Advertisement
Lydss

Untitled

Nov 8th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. ##Imports##
  2. import random
  3. import sqlite3
  4. import tkinter
  5. from tkinter import *
  6. import time
  7. import string
  8.  
  9. root = tkinter.Tk()
  10. root.geometry("600x600")
  11. mainmenu = tkinter.Toplevel()
  12. mainmenu.geometry("600x600")
  13. inputmenu = tkinter.Toplevel()
  14. inputmenu.geometry("600x600")
  15. mainmenu.withdraw()
  16. inputmenu.withdraw()
  17.  
  18. ##Databases##
  19. conn = sqlite3.connect("Guest_data.db")
  20. c= conn.cursor()
  21.  
  22. #########################################################################################################################################################
  23.  
  24. ##Definitions##
  25. def create_table():
  26. c.execute("CREATE TABLE IF NOT EXISTS guestdata(firstname TEXT, adress TEXT, email TEXT, phonenumber REAL, age REAL)")
  27.  
  28. def main_menu():
  29. root.geometry("600x600")
  30. mainmenu.deiconify()
  31. root.withdraw()
  32.  
  33. def input_menu():
  34. mainmenu.withdraw()
  35. inputmenu.deiconfiy()
  36.  
  37. ##login buttons and entry##
  38. username = Label(root,text = "Username:",font=("Comic Sans MS", 14), bd=15).place(x=0,y=0)
  39. usernameentry = Entry(root).place(x=108,y=20)
  40. password = Label(root,text = "Pasword:",font=("Comic Sans MS", 14), bd=15).place(x=0,y=45)
  41. paswordentry = Entry(root).place(x=108,y=63)
  42.  
  43. ##Login System##
  44. username="Admin"
  45. password="Staff"
  46.  
  47. def try_login():
  48. if username == username_entry.get()and password == password_entry.get():
  49. root.withdraw()
  50. login.deiconfiy()
  51. else:
  52. print("Wrong")
  53. button = tkinter.Button(root, text = "Enter", command = try_login).place(x=245, y=57)
  54.  
  55. ##Button to go to input menu##
  56. nextbtn = tkinter.Button(root, text = "Next", command = main_menu).place(x=235,y=57)
  57.  
  58. mainmenulbl = tkinter.Label(mainmenu, text = 'Welcome to main menu',font=('Comic Sans MS', 14), bd=15).place(x=0,y=60)
  59.  
  60. ##Open Inputmenu##
  61. inputmenubtn = tkinter.Button(mainmenu, text = "Next", command = input_menu).place(x=230, y=13)
  62.  
  63.  
  64. ##withdraws##
  65. mainmenu.withdraw()
  66. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement