From 0468005f81fb1c6e8f0185145a3c8e1900381e03 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Tue, 11 Aug 2020 23:51:48 -0600 Subject: [PATCH] Backport PR #18219: Fixes an issue where WxAgg NavigationToolbar2 broke custom toolbars --- lib/matplotlib/backends/backend_wx.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index f1887a886576..460057cc30e6 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1105,7 +1105,7 @@ def _set_frame_icon(frame): class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar): - def __init__(self, canvas): + def __init__(self, canvas, coordinates=True): wx.ToolBar.__init__(self, canvas.GetParent(), -1) if 'wxMac' in wx.PlatformInfo: @@ -1127,9 +1127,11 @@ def __init__(self, canvas): self.Bind(wx.EVT_TOOL, getattr(self, callback), id=self.wx_ids[text]) - self.AddStretchableSpace() - self._label_text = wx.StaticText(self) - self.AddControl(self._label_text) + self._coordinates = coordinates + if self._coordinates: + self.AddStretchableSpace() + self._label_text = wx.StaticText(self) + self.AddControl(self._label_text) self.Realize() @@ -1334,7 +1336,8 @@ def statbar(self): return self.GetTopLevelParent().GetStatusBar() def set_message(self, s): - self._label_text.SetLabel(s) + if self._coordinates: + self._label_text.SetLabel(s) def set_history_buttons(self): can_backward = self._nav_stack._pos > 0 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