Advertisement
Guest User

bigdickcode

a guest
Jan 11th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. __author__ = 'hcawe1'
  2.  
  3. import tkinter as tk
  4.  
  5. root=tk.Tk()
  6. root.geometry("300x200")
  7. root.title("TRSDatabase")
  8.  
  9. w = 300
  10. h = 200
  11. ws = root.winfo_screenwidth() # width of the screen
  12. hs = root.winfo_screenheight() # height of the screen
  13. x = (ws/2) - (w/2)
  14. y = (hs/2) - (h/2) - 50
  15. root.geometry('%dx%d+%d+%d' % (w, h, x, y))
  16.  
  17. def logonScreen():
  18. global StringV
  19. treeRoad=tk.Label(root,text="Tree Road\nSchool", justify='center')
  20. treeRoad.grid(row=0,columnspan=5)
  21. treeRoad.config(font=("bold", 28))
  22.  
  23. userLabel=tk.Label(root, text="Username:")
  24. userLabel.grid(row=2,column=1,padx=10)
  25. userLabel.config(font=("Ariel", 14))
  26.  
  27. userEntry=tk.Entry(root)
  28. userEntry.grid(row=2,column=2,columnspan=3,padx=25)
  29.  
  30. passLabel=tk.Label(root, text="Password:")
  31. passLabel.grid(row=3,column=1,padx=10)
  32. passLabel.config(font=("Ariel", 14))
  33.  
  34. passEntry=tk.Entry(root)
  35. passEntry.grid(row=3,column=2,columnspan=3,padx=25)
  36. passEntry.config(show="*")
  37.  
  38. StringV = tk.StringVar()
  39. invalidLabel=tk.Label(root, textvariable=StringV)
  40. invalidLabel.grid(row=4,column=1,columnspan=2,padx=10)
  41.  
  42. tk.Button(root,text="Enter",command=lambda:Login()).grid(row=4,column=4)
  43. root.bind("<KeyRelease-Return>",lambda x:Login(passEntry.get(),userEntry.get()))
  44.  
  45. def Login(password,username):
  46. if username.lower() == 'leeman' and password == 'tree':
  47. print("worked")
  48. else:
  49. StringV.set("Invalid, please try again.")
  50.  
  51.  
  52. logonScreen()
  53. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement