Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. from tkinter import *
  2. from Question import *
  3.  
  4. Q = Question(open('db.json'))
  5. root = Tk()
  6. root.geometry("500x600")
  7.  
  8. # navbar = Frame(root, bg="#4FC3F7", width=500)
  9. # navbar.pack(fill=Y, side=LEFT)
  10. #
  11.  
  12. navbar = Frame(root, bg="#d3d3d3", width=100)
  13. navbar.pack(fill=Y, side=LEFT)
  14.  
  15. startButton = Button(navbar, text="Start", width=12)
  16. startButton.pack()
  17. startButton.place(x=3, y=40)
  18.  
  19. optionsButton = Button(navbar, text="Options", width=12)
  20. optionsButton.pack()
  21. optionsButton.place(x=3, y=70)
  22.  
  23. endButton = Button(navbar, text="End quiz", width=12)
  24. endButton.pack()
  25. endButton.place(x=3, y=100)
  26.  
  27. test = Canvas(root, height=200)
  28. test.pack(fill=BOTH)
  29.  
  30.  
  31. #######################################################
  32. for i in range(len(Q.getAllQuestions())):
  33.     question = Frame(test, bg="#fff")
  34.  
  35.     label = Label(question, text=str(i + 1) + ". " + Q.getAllQuestions()[i], fg="black", bg="#fff")
  36.     label.config(font=("Arial", 12))
  37.     label.pack(anchor=W, pady=5, padx=10)
  38.  
  39.     for j in range(len(Q.getAllAnswersFor(i))):
  40.         checkbox = Checkbutton(question, text=Q.getAllAnswersFor(i)[j], variable=IntVar(), bg="#fff")
  41.         checkbox.pack(anchor=W, padx=25)
  42.  
  43.     question.pack(fill=BOTH, padx=30, pady=15)
  44.  
  45.  
  46. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement