diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index b2b8a57191fc..c31c3eda5e18 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -96,7 +96,16 @@ def _on_timer(self): # if _timer is None, this means that _timer_stop has been called; so # don't recreate the timer in that case. if not self._single and self._timer: - self._timer = self.parent.after(self._interval, self._on_timer) + if self._interval > 0: + self._timer = self.parent.after(self._interval, self._on_timer) + else: + # Edge case: Tcl after 0 *prepends* events to the queue + # so a 0 interval does not allow any other events to run. + # This incantation is cancellable and runs as fast as possible + # while also allowing events and drawing every frame. GH#18236 + self._timer = self.parent.after_idle( + lambda: self.parent.after(self._interval, self._on_timer) + ) else: self._timer = None
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: