MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

Quizzler Using Tkinter and Trivia DB API/ui.py:27–55  ·  view source on GitHub ↗
(self, quiz_brain: QuizBrain)

Source from the content-addressed store, hash-verified

25class QuizInterface:
26
27 def __init__(self, quiz_brain: QuizBrain):
28 self.quiz = quiz_brain
29 self.window = Tk()
30 self.window.title("Quizzler")
31 self.window.config(padx=20, pady=20, bg=BACKGROUND)
32
33 self.score_label = Label(text="Score: 0", fg="white", bg=BACKGROUND, font=("Lucida sans", 15, "bold"))
34 self.score_label.grid(row=0, column=1)
35
36 self.canvas = Canvas(width=1000, height=550, bg=CANVAS)
37 self.question_text = self.canvas.create_text(
38 500, 100, width=800, text="Some question text", fill=TEXT, font=FONT, anchor="center", justify="center"
39 )
40 self.canvas.grid(row=1, column=0, columnspan=2, pady=50)
41
42 self.opt_selected = IntVar()
43 self.options = self.create_radio_buttons()
44
45 self.submit_button = Button(
46 text="Submit", command=self.submit_answer, fg=TEXT, font=FONT
47 )
48 self.submit_button.grid(row=3, column=0, columnspan=2)
49
50 if error_message:
51 self.display_error_message(error_message)
52 else:
53 self.get_next_question()
54
55 self.window.mainloop()
56
57 def create_radio_buttons(self):
58 radio_buttons = []

Callers

nothing calls this directly

Calls 3

create_radio_buttonsMethod · 0.95
display_error_messageMethod · 0.95
get_next_questionMethod · 0.95

Tested by

no test coverage detected