Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method to identify the resizing of the main window in Tkinter is <Configure>. This method is associated with the main window widget and is triggered whenever the geometry of the main window is changed, including when it is resized.

To use this method, you first need to bind it to the main window widget:

root.bind('<Configure>', function_name)

function_name is the name of the function that will be executed whenever the main window is resized. Inside this function, you can add code to perform tasks that need to be done when the window is resized.

For example, if you want to track the size of the main window, you can define a function as follows:

def on_resize(event):
    print('New window size: %d x %d' % (event.width, event.height))

Then, you can bind this function to the main window widget as follows:

root.bind('<Configure>', on_resize)

Now, whenever the main window is resized, the on_resize function will be executed and will print the new size of the window.