From 94a2f46f3cf0a6a621833fd3ac31b958e36e4910 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Wed, 19 May 2021 12:06:47 +0100 Subject: [PATCH 1/2] Fix draw recursive loop when resizing figure containing Selector using blit. --- lib/matplotlib/widgets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index f47e29212e21..1b1cbfed793c 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1737,7 +1737,8 @@ def update_background(self, event): self.canvas.draw() self.background = self.canvas.copy_from_bbox(self.ax.bbox) if needs_redraw: - self.update() + for artist in self.artists: + self.ax.draw_artist(artist) def connect_default_events(self): """Connect the major canvas events to methods.""" From 031f77c1bf8a57c32666c0cb06c521878753ec1f Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Wed, 19 May 2021 16:16:34 +0100 Subject: [PATCH 2/2] Fix background when using Selector, blitting and the background hasn't been created yet. --- lib/matplotlib/widgets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 1b1cbfed793c..7d2243f6c553 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1782,6 +1782,8 @@ def update(self): if self.useblit: if self.background is not None: self.canvas.restore_region(self.background) + else: + self.update_background(None) for artist in self.artists: self.ax.draw_artist(artist) self.canvas.blit(self.ax.bbox)