I am drawing an image gallery on canvas. When the window is resized I need to redraw the gallery.
I can bind the
It is not possible to know when the user releases the mouse, if they clicked it on the border of the window. The border is not part of the window, and Tkinter has very little knowledge of events outside of the widgets it creates.
The simplest solution might be to add a delay to your redrawing. In a
<Configure> event, cancel any pending redraws, and schedule a new one to happen in one or two seconds.
class Application(...): def __init__(self, ...): ... self._after_id = None self.bind("<Configure>", self.schedule_redraw) ... def schedule_redraw(self, event): if self._after_id: self.after_cancel(self._after_id) self._after_id = self.after(2000, self.redraw)