Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7e3142

Browse filesBrowse files
authored
Merge pull request #26595 from meeseeksmachine/auto-backport-of-pr-26591-on-v3.8.x
Backport PR #26591 on branch v3.8.x (Fix ToolBase.figure property setter.)
2 parents 5276434 + e2c96a9 commit a7e3142
Copy full SHA for a7e3142

File tree

Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed

‎lib/matplotlib/backend_tools.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_tools.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,15 @@ def __init__(self, toolmanager, name):
118118
lambda self: self._figure.canvas if self._figure is not None else None,
119119
doc="The canvas of the figure affected by this tool, or None.")
120120

121-
@property
122-
def figure(self):
123-
"""The Figure affected by this tool, or None."""
124-
return self._figure
125-
126-
@figure.setter
127-
def figure(self, figure):
121+
def set_figure(self, figure):
128122
self._figure = figure
129123

130-
set_figure = figure.fset
124+
figure = property(
125+
lambda self: self._figure,
126+
# The setter must explicitly call self.set_figure so that subclasses can
127+
# meaningfully override it.
128+
lambda self, figure: self.set_figure(figure),
129+
doc="The Figure affected by this tool, or None.")
131130

132131
def _make_classic_style_pseudo_toolbar(self):
133132
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.