How do I force these ttk apps to resize when I resize the window?
Question: I have comments in a number of places where I've tried to use the
columnconfigure or rowconfigure methods to cause the windows to resize, but
none of it seems to be working. I can also take out mainloop() and my program
runs exactly the same. This leads me to believe I'm perhaps not calling/using
mainloop correctly. The methods are mostly just for organization, and I know
they're not reusable methods right now. I was planning on maybe fixing that at
some point, but that's not the purpose of this post.

    
    
    #!/usr/bin/python
    
    from tkinter import *
    from tkinter import ttk
    import webbrowser
    from dictionary import *
    
    class AI():
    
        def __init__(self):
             self.urls = dictionary.get()
            self.makeMainframe()
            self.makeLabels()
            self.makeDropDown()
            self.makeButton()
            self.makeEntry()
            for child in self.mainframe.winfo_children():
                child.grid_configure(padx=2, pady=2)
                #child.columnconfigure(index='all',weight=1)
                #child.rowconfigure(index='all',weight=1)
    
        def openMenu(self):
            webbrowser.open(self.urls[self.lunchVar.get()])
            print(self.urls[self.lunchVar.get()])
    
        def saveChoice(self, event):
            print(self.foodVar.get())
    
        def makeMainframe(self):
            self.mainframe = ttk.Frame(padding="3 3 12 12")
            self.mainframe.grid(column=0, row=0, sticky=(N,W,E,S))
            #self.mainframe.columnconfigure('all', weight=1)
            #self.mainframe.rowconfigure(index='all', weight=1)
    
        def makeDropDown(self):
            self.lunchVar = StringVar()
    
            self.lunchChoice = ttk.Combobox(self.mainframe, textvariable=self.lunchVar, state='readonly')
            self.lunchChoice['values'] = list(self.urls.keys())
            self.lunchChoice.grid(column=2, row=1, sticky=(W, E))
    
        def makeLabels(self):
            ttk.Label(self.mainframe, text="Today's lunch is from...").grid(column=1, row=1, sticky=(E,W))
            ttk.Label(self.mainframe, text="Click here for a menu  -->").grid(column=1, row=2, sticky=(E,W))
            ttk.Label(self.mainframe, text="What will you be having?").grid(column=1, row=3, sticky=(E,W))
    
        def makeButton(self):
            self.menu = ttk.Button(self.mainframe, textvariable=self.lunchVar, command=self.openMenu)
            self.menu.grid(column=2, row=2, sticky=(W, E))
    
        def makeEntry(self):
            self.foodVar = StringVar()
            self.foodChoice = ttk.Entry(self.mainframe, textvariable=self.foodVar)
            self.foodChoice.grid(column=2, row=3, sticky=(E,W))
            self.foodChoice.bind("<Return>", self.saveChoice)
            #self.foodChoice.columnconfigure(index='all', weight=1)
    
    AI=AI()
    mainloop()
    


Answer: You place `self.mainframe` in the root window, but you never give any rows and
columns in the root window a weight. You also never explicitly create a root
window, though that isn't contributing to the problem. Also, `"all"` isn't a
valid row or column.

The first step is to get your main frame to resize, then you can focus on the
contents inside the frame.

    
    
    def makeMainframe(self):
        ...
        self.mainframe._root().columnconfigure(0, weight=1)
        self.mainframe._root().rowconfigure(index=0, weight=1)
    

Note: in the case where you're putting a single frame inside some other widget
(such as the root window), `pack` is arguably a better choice because you
don't have to remember to give weight to the rows and columns. You can replace
this:

    
    
    self.mainframe.grid(column=0, row=0, sticky=(N,W,E,S))
    self.mainframe._root().columnconfigure(0, weight=1)
    self.mainframe._root().rowconfigure(index=0, weight=1)
    

... with this:

    
    
    self.mainframe.pack(fill="both", expand=True)
    

Assuming that you want the entry widgets to expand to fill the space
horizontally, you need to do the same with `mainframe`:

    
    
    def makeMainframe(self):
        ...
        self.mainframe.grid_columnconfigure(2, weight=1)
    

