btonasse
btonasse

Reputation: 102

Tkinter - how to prevent user window resize from disabling autoresize?

I have a question related to an annoying behavior I have observed recently in tkinter. When there's no fixed window size defined, the main window is expanded when adding new frames, which is great. However, if prior to adding a new widget the user only so much as touches the resizing handles, resizing the main window manually, then the window does not expand to fit the new widget. Why is that so and is there a way to prevent this behavior?

Thanks in advance!

Upvotes: 0

Views: 125

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 386030

The why is because tkinter was designed to let the user ultimately control the size of the window. If the user sets the window size, tkinter assumes it was for a reason and thus honors the requested size.

To get the resize behavior back, pass an empty string to the geometry method of the window.

Upvotes: 1

Related Questions