python - Expand Tkinter Frame -


i have basic application using tkinter python (3.5). want application run in full screen, , have multiple windows switch through. far have.

import tkinter tk  class window(tk.tk):  def __init__(self):     tk.tk.__init__(self)      self.title("movie kiosk")     self.attributes("-fullscreen", true)     self.resizable(width=false, height=false)      container = tk.frame(self)     container.pack(side="top", fill="both", expand=1)      self.frames = {}      f in (startpage, pageone):         frame = f(container, self)         self.frames[f] = frame         frame.grid(row=0, column=0, sticky="nsew")      self.show_frame(startpage)  def show_frame(self, cont):     frame = self.frames[cont]     frame.tkraise()  class startpage(tk.frame):  def __init__(self, parent, controller):     tk.frame.__init__(self, parent)     label = tk.label(self, text="main page", font=("verdana",48))     label.place(relx=0.5, y=0, anchor=tk.n)     button = tk.button(self, text="go page 1",                        command=lambda: controller.show_frame(pageone))     button.place(relx=1, rely=1, anchor=tk.se)     exitbutton = tk.button(self, text="close program", command=exit)     exitbutton.place(relx=0, rely=1, anchor=tk.sw)  class pageone(tk.frame):  def __init__(self, parent, controller):     tk.frame.__init__(self, parent)     label = tk.label(self, text="page 1")     label.pack()     button = tk.button(self, text="back home",                        command=lambda: controller.show_frame(startpage))     button.pack()   app = window() app.mainloop() 

when run application, program loads in full screen mode, frame , widgets packed tightly in top left corner of screen. not sure why happening, have messed around changing properties of my "app" , frames. if tell me whats wrong or direct me place can find answer appreciated. thanks.

not sure why fixes it...

container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) 

adding code after packing container fixes problem.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -