From ab3c6967fa6df7ef1277ed1dc7d79bc6cde54989 Mon Sep 17 00:00:00 2001 From: richardsheridan Date: Tue, 18 Aug 2020 09:51:45 -0400 Subject: [PATCH 1/2] use after idle after 0 incantation for TkTimer --- lib/matplotlib/backends/_backend_tk.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index b2b8a57191fc..2b00f6b1e8e5 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: + 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 From 5ca19cde4b5150f854c53bf96073060f688c9ed8 Mon Sep 17 00:00:00 2001 From: richardsheridan Date: Tue, 18 Aug 2020 15:39:33 -0400 Subject: [PATCH 2/2] boolean check to int comparison Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/backends/_backend_tk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index 2b00f6b1e8e5..c31c3eda5e18 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -96,7 +96,7 @@ 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: - if self._interval: + 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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy