Advertisement
Alexchenys

ui.py

Feb 28th, 2021
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. from tkinter import *
  2. THEME_COLOR = "#375362"
  3.  
  4. class QuizInterface:
  5.  
  6.     def __init__(self):
  7.  
  8.         ## window setup
  9.         self.window = Tk()
  10.         self.window.title("Quizzler")
  11.         self.window.configure(padx=20, pady=20, background=THEME_COLOR)
  12.         ## score label
  13.         self.label = Label(text="Score:0", fg="white", bg=THEME_COLOR)
  14.         self.label.grid(column=1, row=0)
  15.  
  16.         ## Flash Card(canvas)
  17.         self.canvas = Canvas(self.window, width=300, height=250, bg="white")
  18.         self.canvas.grid(column=0, row=1, columnspan=2, pady=50)
  19.         self.Question = self.canvas.create_text(150, 125, font=("Ariel", 14, 'italic'), text="大家好")
  20.  
  21.         ## buttom
  22.         self.right = PhotoImage(file="images/true.png")
  23.         self.wrong = PhotoImage(file="images/false.png")
  24.         #### Image
  25.         self.right_buttom = Button(image=self.right, highlightthickness=0)
  26.         self.right_buttom.grid(column=0, row=2)
  27.         self.wright_buttom = Button(image=self.wrong, highlightthickness=0)
  28.         self.wright_buttom.grid(column=1, row=2)
  29.  
  30.         self.window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement