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

Skip to content

Deprecate accepting arbitrary parameters in some get_window_extent() methods #22123

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 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/22123-TH.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``Axes.get_window_extent`` and ``Figure.get_window_extent`` won't accept parameters other than *renderer* anymore
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This aligns the API with the general `.Artist.get_window_extent` API.
All parameters were ignored anyway.
4 changes: 3 additions & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ def __repr__(self):
fields += [f"ylabel={self.get_ylabel()!r}"]
return f"<{self.__class__.__name__}:" + ", ".join(fields) + ">"

def get_window_extent(self, *args, **kwargs):
@_api.delete_parameter("3.6", "args")
@_api.delete_parameter("3.6", "kwargs")
def get_window_extent(self, renderer=None, *args, **kwargs):
"""
Return the Axes bounding box in display space; *args* and *kwargs*
are empty.
Expand Down
4 changes: 3 additions & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ def contains(self, mouseevent):
inside = self.bbox.contains(mouseevent.x, mouseevent.y)
return inside, {}

def get_window_extent(self, *args, **kwargs):
@_api.delete_parameter("3.6", "args")
@_api.delete_parameter("3.6", "kwargs")
def get_window_extent(self, renderer=None, *args, **kwargs):
# docstring inherited
return self.bbox

Expand Down