Continuous calls of the <Configure> event in tkinter
events, tkinter
Solution
According to the official tk documentation, `<Configure>` events fire "whenever its size, position, or border width changes, and sometimes when it has changed position in the stacking order." This can happen several times during startup.
It is called continuously while you resize the window because the size of the widget is changing. That's what it's defined to do. You can't prevent it from being called, though you can certainly modify what you do in the callback. For example, you could delay resizing the image until you've not received another `<Configure>` event for a second or two -- which likely means the user has stopped interactive resizing.
Problem
I am trying to write a function to dynamically resize an image displayed in a tkinter window. Therefore I bound this function to the `Configure` event: `connroot.bind( "<Configure>", connresiz) ` My problems are: That the `connresiz()` function gets called 3 times (why 3?) at program start, and More troublesome, that dynamically resizing the window calls the function continuously as I drag the mouse! How can avoid this? I thought about checking at the simultaneous presence of a `<Configure>` and `<ButtonRelease-1>` events, but I don't know how to code it.