Skip to content

Expire wx canvas param deprecation #25192

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
Feb 18, 2023
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/behavior/25192-DS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``canvas`` argument now required for ``FigureFrameWx``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``FigureFrameWx`` now requires a keyword-only ``canvas`` argument
when it is constructed.
13 changes: 2 additions & 11 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ def _print_image(self, filetype, filename):


class FigureFrameWx(wx.Frame):
def __init__(self, num, fig, *, canvas_class=None):
def __init__(self, num, fig, *, canvas_class):
# On non-Windows platform, explicitly set the position - fix
# positioning bug on some Linux platforms
if wx.Platform == '__WXMSW__':
Expand All @@ -914,16 +914,7 @@ def __init__(self, num, fig, *, canvas_class=None):
_log.debug("%s - __init__()", type(self))
_set_frame_icon(self)

# The parameter will become required after the deprecation elapses.
if canvas_class is not None:
self.canvas = canvas_class(self, -1, fig)
else:
_api.warn_deprecated(
"3.6", message="The canvas_class parameter will become "
"required after the deprecation period starting in Matplotlib "
"%(since)s elapses.")
self.canvas = self.get_canvas(fig)

self.canvas = canvas_class(self, -1, fig)
# Auto-attaches itself to self.canvas.manager
manager = FigureManagerWx(self.canvas, num, self)

Expand Down