I have a window containing widgets with a grid layout, created by this code:
from tkinter import *
window = Tk()
label = Label(text="that label")
label.grid(row=0, column=0, sticky='EW')
entry = Entry()
entry.grid(row=1, column=0, sticky='EW')
window.mainloop()
I would expect the label and entry widget to resize with the window, but if I enlarge the window, it looks like this:
If I use pack
instead of grid
(with the fill
option) like so:
from tkinter import *
window = Tk()
label = Label(text="that label")
label.pack(fill=X)
entry = Entry()
entry.pack(fill=X)
window.mainloop()
Then the enlarged window looks like this (what I would want it to look like):
Why don't the widgets resize with the window when using grid
and how do I make them do it?