Guest User

code

a guest
Feb 24th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. LARGE_FONT= ("Verdana", 14)
  4.  
  5. class MathsQuizapp(tk.Tk):
  6.  
  7. def __init__(self, *args, **kwargs):
  8. tk.Tk.__init__(self, *args, **kwargs)
  9.  
  10. container = tk.Frame(self)
  11. container.pack(side="top", fill="both", expand = True)
  12. container.grid_rowconfigure(0, weight=1)
  13. container.grid_columnconfigure(0, weight=1)
  14.  
  15. self.frames = {}
  16.  
  17. frame = NamePage(container, self)
  18.  
  19. self.frames[NamePage] = frame
  20.  
  21. frame.grid(row=0, column=0, sticky="nsew")
  22.  
  23. self.show_frame(NamePage)
  24.  
  25. def show_frame(self, cont):
  26.  
  27. frame = self.frames[cont]
  28. frame.tkraise()
  29.  
  30. class NamePage(tk.Frame):
  31.  
  32. def _init__(self, *args, **kwargs):
  33. tk.Frame.__init__(self, parent)
  34. label = tk.label(self, text="Please enter your name", font=LARGE_FONT)
  35. label.pack(pady=10, padx=10)
  36.  
  37. app = MathsQuizapp()
  38. app.mainloop()
Add Comment
Please, Sign In to add comment