Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import *
- import tkinter
- window = Tk()
- width_of_window = 925
- height_of_window = 825
- screen_width = window.winfo_screenwidth()
- screen_height = window.winfo_screenheight()
- x_coordinate = (screen_width/2) - (width_of_window/2)
- y_coordinate = (screen_height/2) - (height_of_window/2)
- window.geometry("%dx%d+%d+%d" % (width_of_window , height_of_window, x_coordinate, y_coordinate))
- window.configure(background = "#6CA6CD")
- window.title("Please Login")
- window.wm_iconbitmap('smiley.ico.')
- lblInst = tkinter.Label(window, text="Please login to continue:" , fg = "#383a39" , bg= "#6CA6CD" , font = ("Helventica" , 60))
- lblInst.pack()
- lblUsername = tkinter.Label(window, text = "\nUsername:" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- entUsername = tkinter.Entry(window, fg = "#383a39", font = ("Helventica" , 45))
- lblUsername.pack()
- entUsername.pack()
- lblPassword = tkinter.Label(window, text= "Password:", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- entPassword = tkinter.Entry(window, fg = "#383a39", font = ("Helventica" , 45))
- entPassword.config(show = "*" )
- lblPassword.pack()
- entPassword.pack()
- username = ("a")
- password = ("a")
- questiontwo = ("eastside")
- questionone = ("happier")
- def callback2():
- global questiontwoentry
- questiontwoinput = questiontwoentry.get()
- if questiontwo == questiontwoinput:
- print("Yes")
- window3.destroy()
- else:
- print("No")
- gap10.configure(text = "Incorrect. Please try again!")
- def callback():
- global username
- global passw
- user = entUsername.get()
- pasw = entPassword.get()
- if user == username and pasw == password:
- print("Yes")
- window2 = Tk()
- width_of_window2 = 925
- height_of_window2 = 825
- screen_width2 = window.winfo_screenwidth()
- screen_height2 = window.winfo_screenheight()
- x_coordinate2 = (screen_width2/2) - (width_of_window2/2)
- y_coordinate2 = (screen_height2/2) - (height_of_window2/2)
- window2.geometry("%dx%d+%d+%d" % (width_of_window2 , height_of_window2, x_coordinate2, y_coordinate2))
- window.destroy()
- window2.configure(background = "#6CA6CD")
- window2.title("Question 1!")
- 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))
- score = ("0")
- global score
- scorename1 = tkinter.Label(window2, text = ("Your current score is : " + str(score)) , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 35))
- scorename1.pack()
- ######score = score + 3
- questiononeentry = tkinter.Entry(window2, fg = "#383a39", font = ("Helventica" , 45))
- def callback1():
- questiononeinput = questiononeentry.get()
- if questionone == questiononeinput:
- print("Yes")
- window3 = Tk()
- window2.destroy()
- width_of_window3 = 975
- height_of_window3 = 825
- screen_width3 = window3.winfo_screenwidth()
- screen_height3 = window3.winfo_screenheight()
- x_coordinate3 = (screen_width3/2) - (width_of_window3/2)
- y_coordinate3 = (screen_height3/2) - (height_of_window3/2)
- window3.geometry("%dx%d+%d+%d" % (width_of_window3 , height_of_window3, x_coordinate3, y_coordinate3))
- window3.configure(background = "#6CA6CD")
- window3.title("Question 2!")
- global score
- scorename2 = tkinter.Label(window3, text = ("Your current score is : " + str(score)) , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 35))
- scorename2.pack()
- 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))
- questiontwoentry = tkinter.Entry(window3, fg = "#383a39", font = ("Helventica" , 45))
- global questiontwoentry
- global window3
- lblquestiontwo1.pack()
- questiontwoentry.pack()
- gap7 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap7.pack()
- gap10 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- button2 = tkinter.Button(window3, text= "Submit", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback2)
- button2.pack()
- gap11 = tkinter.Label(window3, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap11.pack()
- gap10.pack()
- global gap10
- else:
- print("No")
- gap5.configure(text = "Incorrect. Please try again!")
- lblquestionone1.pack()
- questiononeentry.pack()
- gap6 = tkinter.Label(window2, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap4 = tkinter.Label(window2, text = "" , fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap4.pack()
- button1 = tkinter.Button(window2, text= "Submit", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback1)
- gap5 = tkinter.Label(window2, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- button1.pack()
- gap6.pack()
- gap5.pack()
- else:
- print("No")
- gap3.configure(text = "Incorrect Login. Please try again!")
- gap = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap2 = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- gap3 = tkinter.Label(window, text= "", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45))
- button = tkinter.Button(window, text= "Login", fg = "#383a39", bg = "#6CA6CD" , font = ("Helventica" , 45), command = callback)
- gap.pack()
- button.pack()
- gap2.pack()
- gap3.pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement