File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1456,8 +1456,21 @@ def update_background(self, event):
14561456 """Force an update of the background."""
14571457 # If you add a call to `ignore` here, you'll want to check edge case:
14581458 # `release` can call a draw event even when `ignore` is True.
1459- if self .useblit :
1459+ if not self .useblit :
1460+ return
1461+ # Make sure that widget artists don't get accidentally included in the
1462+ # background, by re-rendering the background if needed (and then
1463+ # re-re-rendering the canvas with the visible widget artists).
1464+ needs_redraw = any (artist .get_visible () for artist in self .artists )
1465+ with ExitStack () as stack :
1466+ if needs_redraw :
1467+ for artist in self .artists :
1468+ stack .callback (artist .set_visible , artist .get_visible ())
1469+ artist .set_visible (False )
1470+ self .canvas .draw ()
14601471 self .background = self .canvas .copy_from_bbox (self .ax .bbox )
1472+ if needs_redraw :
1473+ self .update ()
14611474
14621475 def connect_default_events (self ):
14631476 """Connect the major canvas events to methods."""
You can’t perform that action at this time.
0 commit comments