From 60a5e5708623126f1c354cba93109445723357fa Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 12 Feb 2018 07:20:22 +0100 Subject: [PATCH] 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. --- lib/matplotlib/backends/backend_wx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index eca26613c93f..1d1cf68e0583 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1229,7 +1229,7 @@ def _get_toolbar(self, statbar): return toolbar def get_canvas(self, fig): - return type(self.canvas)(self, -1, fig) + return FigureCanvasWx(self, -1, fig) def get_figure_manager(self): DEBUG_MSG("get_figure_manager()", 1, self) @@ -1507,7 +1507,7 @@ def __init__(self, canvas): self.retinaFix = 'wxMac' in wx.PlatformInfo def get_canvas(self, frame, fig): - return FigureCanvasWx(frame, -1, fig) + return type(self.canvas)(frame, -1, fig) def _init_toolbar(self): DEBUG_MSG("_init_toolbar", 1, self) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy