Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #26591 on branch v3.8.x (Fix ToolBase.figure property setter.) #26595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,15 @@ def __init__(self, toolmanager, name):
lambda self: self._figure.canvas if self._figure is not None else None,
doc="The canvas of the figure affected by this tool, or None.")

@property
def figure(self):
"""The Figure affected by this tool, or None."""
return self._figure

@figure.setter
def figure(self, figure):
def set_figure(self, figure):
self._figure = figure

set_figure = figure.fset
figure = property(
lambda self: self._figure,
# The setter must explicitly call self.set_figure so that subclasses can
# meaningfully override it.
lambda self, figure: self.set_figure(figure),
doc="The Figure affected by this tool, or None.")

def _make_classic_style_pseudo_toolbar(self):
"""
Expand Down