I'm experiencing some odd behavior when I bind() a callback
to <Configure>
on a Label I'm using to contain an image
I want to resize as its containing Toplevel is resized.
According to the documentation, the <Configure>
callback
is supposed to get called when the user resizes the window
(i.e. the Toplevel). What I'm finding is that the callback is
getting called with no user interaction. In fact, it seems to be
getting called when I update the image from the handler in
response to the resize, which leads to an annoying loop which
ends when the user moves (!) the window. Every call has
event.width
and/or event.height
slightly larger or smaller,
depending on how I've resized the image. It's almost as though
the call I make to set the new image
(Label.configure(image={newImage})
) was triggering the
callback, but this makes no sense.
I've tried tracing this with pdb, but all I find is a call coming from Tkinter.Tk.mainloop() with no indication of what led to it. I've also tried to duplicate this with a small demo program (which I could include here), but cannot, so I'm hoping someone might at least be able to answer the question:
Apart from user interaction (or any explicit call in my own
code), what could cause a <Configure>
callback to be called?
Thanks.