Reputation: 434
I have a test app that uses Python and Tkinter to present a number of text boxes to the user using the grid layout manager.
To reduce clutter on the screen I have a Show/Hide button that removes and show several non-critical widgets:
if show_all:
# Display widget
widget.grid()
else :
# Hide widget
widget.grid_remove()
What I would like to do next is force the main window to resize after the widgets have been modified.
Any suggestions are welcome.
Upvotes: 0
Views: 1960
Reputation: 385890
By default the main window should resize, assuming the user hasn't resized the window. If the user has resized the window, you might want to rethink the need to shrink it. If they resized it, they probably want it at the size they resized it to.
Regardless, try setting the window geometry of the main window (eg: root.wm_geometry("")
) to the empty string. That will trigger the main window to re-layout its children.
Upvotes: 1