-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2. Quiz
More file actions
38 lines (31 loc) · 976 Bytes
/
Copy path2. Quiz
File metadata and controls
38 lines (31 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from tkinter import *
from tkinter import messagebox
root = Tk()
root.title("Quiz")
root.geometry("300x300")
def que_one():
question = Label (root, text="There's a pear hanging and you can't eat it?")
answer = Entry()
btn = Button(root, text="Reply", command=lambda: game1(que_two))
question.grid()
answer.grid()
btn.grid()
def game1(que_two):
if answer.get().lower() == "bulb":
que_two()
else:
messagebox.showerror("Error", "Try again")
def que_two():
question_2 = Label (root, text="Winter and summer in the same color")
answer_2 = Entry()
btn_2 = Button (root, text="Reply", command=lambda: game2(que_two))
question_2.grid()
answer_2.grid()
btn_2.grid()
def game2(que_two):
if answer_2.get().lower() == "tree":
messagebox.showinfo("Victory", "Well done")
else:
messagebox.showerror("Error", "Try again")
que_one()
root.mainloop()