Skip to content Skip to sidebar Skip to footer

Python Tkinter Canvas Not Resizing

I'm trying to subclass some tkinter controls to make an auto scrolling frame for use in my program, i only want it to scroll vertically, and when widgets are added that need it to

Solution 1:

why does resizing the window stop the call to:

self.canvas.config(width=self.interior.winfo_reqwidth())

That is because your code is bound to the frame changing. When the user resizes the window, you resize the window, not the frame. If you want the function to be called when the window is resized you must bind it or a similar function to the resizing of the window or canvas in addition to the automatic resizing of the interior frame.

You'll also need to be aware that if the user resizes the window, adding objects to the frame in the canvas won't make the window bigger. The user's choice of window size will override the computed size from the interior widgets being resized. You'll have to reset the geometry to the empty string to get it to automatically grow.

Post a Comment for "Python Tkinter Canvas Not Resizing"