File tree 1 file changed +14
-1
lines changed
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):
1456
1456
"""Force an update of the background."""
1457
1457
# If you add a call to `ignore` here, you'll want to check edge case:
1458
1458
# `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 ()
1460
1471
self .background = self .canvas .copy_from_bbox (self .ax .bbox )
1472
+ if needs_redraw :
1473
+ self .update ()
1461
1474
1462
1475
def connect_default_events (self ):
1463
1476
"""Connect the major canvas events to methods."""
You can’t perform that action at this time.
0 commit comments