Tkinter top-level windows seem to have two βmodesβ: where the size is determined by the application and where the user controls the size. Consider this code:
from tkinter import * class Test(Frame): def __init__(self,parent): Frame.__init__(self,parent) self.b1 = Button(self, text="Button 1",command=self.b1Press) self.b1.pack() def b1Press(self): print("b1Press") label = Label(self, text="Label") label.pack() root = Tk() ui = Test(root) ui.pack(fill='both', expand=1) root.mainloop()
Each time I click the button, the visible window resizes to fit the extra label. However, if I manually resize the window (using the mouse), then it stops this automatic resizing behavior, and from then on I must manually resize the window to see new buttons as they are added.
What determines if the size of the top-level window is under the control of the application or user?
How can an application restore automatic calibration after manually resizing a user?
python tkinter
timbod
source share