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 60a5e57

Browse filesBrowse files
committed
Fix wx canvas type injection.
NavigationToolbar2Wx should use `type(self.canvas)` when instantiating the canvas to make it work with all of wx, wxagg, wxcairo (instantiating the corresponding canvas class in each case). Conversely, FigureFrameWx should explicitly use FigureCanvasWx; other backends (wxagg, wxcairo) override the method accordingly. I got these inverted in my previous PR and this breaks the wx backend.
1 parent 2099af4 commit 60a5e57
Copy full SHA for 60a5e57

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ def _get_toolbar(self, statbar):
12291229
return toolbar
12301230

12311231
def get_canvas(self, fig):
1232-
return type(self.canvas)(self, -1, fig)
1232+
return FigureCanvasWx(self, -1, fig)
12331233

12341234
def get_figure_manager(self):
12351235
DEBUG_MSG("get_figure_manager()", 1, self)
@@ -1507,7 +1507,7 @@ def __init__(self, canvas):
15071507
self.retinaFix = 'wxMac' in wx.PlatformInfo
15081508

15091509
def get_canvas(self, frame, fig):
1510-
return FigureCanvasWx(frame, -1, fig)
1510+
return type(self.canvas)(frame, -1, fig)
15111511

15121512
def _init_toolbar(self):
15131513
DEBUG_MSG("_init_toolbar", 1, self)

0 commit comments

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