Advertisement
Guest User

Untitled

a guest
Oct 7th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. import tkinter as tk
  2. from tkinter import *
  3. import tkinter
  4. window = Tk()
  5. width_of_window = 925
  6. height_of_window = 825
  7. screen_width = window.winfo_screenwidth()
  8. screen_height = window.winfo_screenheight()
  9. x_coordinate = (screen_width/2) - (width_of_window/2)
  10. y_coordinate = (screen_height/2) - (height_of_window/2)
  11. window.geometry("%dx%d+%d+%d" % (width_of_window , height_of_window, x_coordinate, y_coordinate))
  12. window.configure(background = "#6CA6CD")
  13. window.title("Please Login")
  14. window.wm_iconbitmap('smiley.ico.')
  15. lblInst = tkinter.Label(window, text="Please login to continue:" , fg = "#383a39" , bg= "#6CA6CD" , font = ("Helventica" , 60))
  16. lblInst.pack()
  17. lblUsername = tkinter.Label(window, text = "\nUsername:" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  18. entUsername = tkinter.Entry(window, fg = "#383a39", font = ("Helventica" , 45))
  19. lblUsername.pack()
  20. entUsername.pack()
  21. lblPassword = tkinter.Label(window, text= "Password:", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  22. entPassword = tkinter.Entry(window, fg = "#383a39", font = ("Helventica" , 45))
  23. entPassword.config(show = "*" )
  24. lblPassword.pack()
  25. entPassword.pack()
  26. username = ("a")
  27. password = ("a")
  28. questiontwo = ("eastside")
  29. questionone = ("happier")
  30. def callback2():
  31. global questiontwoentry
  32. questiontwoinput = questiontwoentry.get()
  33. if questiontwo == questiontwoinput:
  34. print("Yes")
  35. window3.destroy()
  36. else:
  37. print("No")
  38. gap10.configure(text = "Incorrect. Please try again!")
  39.  
  40. def callback():
  41. global username
  42. global passw
  43. user = entUsername.get()
  44. pasw = entPassword.get()
  45. if user == username and pasw == password:
  46. print("Yes")
  47. window2 = Tk()
  48. width_of_window2 = 925
  49. height_of_window2 = 825
  50. screen_width2 = window.winfo_screenwidth()
  51. screen_height2 = window.winfo_screenheight()
  52. x_coordinate2 = (screen_width2/2) - (width_of_window2/2)
  53. y_coordinate2 = (screen_height2/2) - (height_of_window2/2)
  54. window2.geometry("%dx%d+%d+%d" % (width_of_window2 , height_of_window2, x_coordinate2, y_coordinate2))
  55. window.destroy()
  56. window2.configure(background = "#6CA6CD")
  57. window2.title("Question 1!")
  58. lblquestionone1 = tkinter.Label(window2, text = "What is the name of this song?\nby Marshmello, on the top charts?\n\nh _ _ _ _ _ _\n" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  59. score = ("0")
  60. global score
  61. scorename1 = tkinter.Label(window2, text = ("Your current score is : " + str(score)) , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 35))
  62. scorename1.pack()
  63. ######score = score + 3
  64. questiononeentry = tkinter.Entry(window2, fg = "#383a39", font = ("Helventica" , 45))
  65.  
  66. def callback1():
  67. questiononeinput = questiononeentry.get()
  68. if questionone == questiononeinput:
  69. print("Yes")
  70. window3 = Tk()
  71. window2.destroy()
  72. width_of_window3 = 975
  73. height_of_window3 = 825
  74. screen_width3 = window3.winfo_screenwidth()
  75. screen_height3 = window3.winfo_screenheight()
  76. x_coordinate3 = (screen_width3/2) - (width_of_window3/2)
  77. y_coordinate3 = (screen_height3/2) - (height_of_window3/2)
  78. window3.geometry("%dx%d+%d+%d" % (width_of_window3 , height_of_window3, x_coordinate3, y_coordinate3))
  79. window3.configure(background = "#6CA6CD")
  80. window3.title("Question 2!")
  81. global score
  82. scorename2 = tkinter.Label(window3, text = ("Your current score is : " + str(score)) , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 35))
  83. scorename2.pack()
  84. lblquestiontwo1 = tkinter.Label(window3, text = "What is the name of this song?\nby Benny Blanco, on the top charts?\n\ne _ _ _ _ _ _ _\n" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  85. questiontwoentry = tkinter.Entry(window3, fg = "#383a39", font = ("Helventica" , 45))
  86. global questiontwoentry
  87. global window3
  88. lblquestiontwo1.pack()
  89. questiontwoentry.pack()
  90. gap7 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  91. gap7.pack()
  92. gap10 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  93. button2 = tkinter.Button(window3, text= "Submit", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback2)
  94. button2.pack()
  95. gap11 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  96. gap11.pack()
  97. gap10.pack()
  98. global gap10
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. else:
  107. print("No")
  108. gap5.configure(text = "Incorrect. Please try again!")
  109.  
  110. lblquestionone1.pack()
  111. questiononeentry.pack()
  112. gap6 = tkinter.Label(window2, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  113. gap4 = tkinter.Label(window2, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  114. gap4.pack()
  115. button1 = tkinter.Button(window2, text= "Submit", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback1)
  116. gap5 = tkinter.Label(window2, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  117. button1.pack()
  118. gap6.pack()
  119. gap5.pack()
  120.  
  121. else:
  122. print("No")
  123. gap3.configure(text = "Incorrect Login. Please try again!")
  124. gap = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  125. gap2 = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  126. gap3 = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
  127. button = tkinter.Button(window, text= "Login", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback)
  128. gap.pack()
  129. button.pack()
  130. gap2.pack()
  131. gap3.pack()
  132. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement