-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathui.py
More file actions
45 lines (28 loc) · 1.39 KB
/
Copy pathui.py
File metadata and controls
45 lines (28 loc) · 1.39 KB
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
39
40
41
42
43
44
45
import tkinter
from tkinter import *
from quiz_brain import QuizBrain
THEME_COLOR = "#375362"
class QuizInterface:
def __init__(self, quiz_brain:QuizBrain):
self.quiz = quiz_brain
self.window = Tk()
self.window.title("Quizzler")
self.window.config(padx=20, pady=20, bg=THEME_COLOR)
self.score_label=Label(text="Score: 0", fg="white",bg=THEME_COLOR)
self.score_label.grid(row=0, column=1)
self.window.geometry('1200x1000+500+50')
self.window.resizable(True, True)
self.canvas = Canvas(width=1100, height=850, bg="white")
self.question_text = self.canvas.create_text(150,125,text="Some question Text", fill=THEME_COLOR, font=("Roboto",20, "italic"),width=825)
self.canvas.grid(row=1,column=0, columnspan=2,pady=50)
true_image = PhotoImage(file="images/true.png")
self.true_button = Button(image=true_image,highlightthickness=0)
self.true_button.grid(row=2,column=0)
false_image = PhotoImage(file="images/false.png")
self.false_button = Button(image=false_image,highlightthickness=0)
self.false_button.grid(row=2,column=1)
self.get_next_question()
self.window.mainloop()
def get_next_question(self):
q_text = self.quiz.next_question()
self.canvas.itemconfig(self.question_text, text=q_text)