Resizing tkinter windows and contents
Question: I am using python tkinter to build a ui containing a matplotlib figure and
some buttons, but am having difficulty with resizing the window and it's
contents. I've looked at some of the examples on this site and the docs and as
I understand it, for a frame containing smaller frames to resize together they
all need to be configured individually. Each one gets a weight applied to it
to define how much of the available space it receives (is this correct?).
However, when I try to apply this as shown below none of the frames resize.
Also if the wiegth is zero for columnconfigure and 1 for row configure does
that mean it will only resize in one direction?

    
    
    import Tkinter
    from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
    from matplotlib.figure import Figure
    class Application():
        def __init__(self, master):
    
    
            frame2 = Tkinter.Frame(master, height=510, width=770, bg='red')
            frame2.grid(row=0, column=0, sticky='nsew')
            frame2.columnconfigure(0, weight=1)
            frame2.rowconfigure(0, weight=1)
    
            frame2a = Tkinter.Frame(frame2, height=80, width=770, bg='blue') 
            frame2a.grid(row=0, column=0, sticky='nsew')
            frame2a.columnconfigure(0, weight=1)
            frame2a.rowconfigure(0, weight=1)        
    
            frame2b = Tkinter.Frame(frame2, height=410, width=770, bg='green') 
            frame2b.grid(row=1, column= 0, sticky='nsew')
            frame2b.columnconfigure(0, weight=1)
            frame2b.rowconfigure(1, weight=1)    
    
            # add plot
            fig = Figure(figsize=(9.5,5.2), facecolor='white')
            fig.add_subplot(111)        
            canvas = FigureCanvasTkAgg(fig, master=frame2b)
    
            canvas.show()
            canvas.get_tk_widget().pack(side='top', fill='both', expand=1)
    
    if __name__ == '__main__' :
    
        root = Tkinter.Tk()
        root.geometry("770x510")
        app = Application(root)
        root.mainloop()
    


Answer: Your approach using `columnconfigure` and `rowconfigure` is correct, but you
forgot one thing: You haven't used the methods on the _master_ window. So, you
basically want to do this:

    
    
    def __init__(self, master):
        master.columnconfigure(0, weight=1)
        master.rowconfigure(0, weight=1)
    

To answer your other question (_Also if the wiegth is zero for columnconfigure
and 1 for row configure does that mean it will only resize in one
direction?_): Yes, you're right, the widget/window would extend in just one or
none direction then.

Additionally, since you are using `grid` for dynamic resizing, the `height`
and `width` parameters are obsolete.

