Skip to content

Commit 2abaa0d

Browse files
committed
Fixes an issue in the wxagg backend where custom subclasses of the NavigationToolbar2 would end up with buttons in the wrong place.
1 parent 9b7f94f commit 2abaa0d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ def _set_frame_icon(frame):
11091109

11101110

11111111
class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
1112-
def __init__(self, canvas):
1112+
def __init__(self, canvas, coordinates=True):
11131113
wx.ToolBar.__init__(self, canvas.GetParent(), -1)
11141114

11151115
if 'wxMac' in wx.PlatformInfo:
@@ -1131,9 +1131,11 @@ def __init__(self, canvas):
11311131
self.Bind(wx.EVT_TOOL, getattr(self, callback),
11321132
id=self.wx_ids[text])
11331133

1134-
self.AddStretchableSpace()
1135-
self._label_text = wx.StaticText(self)
1136-
self.AddControl(self._label_text)
1134+
self._coordinates = coordinates
1135+
if self._coordinates:
1136+
self.AddStretchableSpace()
1137+
self._label_text = wx.StaticText(self)
1138+
self.AddControl(self._label_text)
11371139

11381140
self.Realize()
11391141

@@ -1338,7 +1340,8 @@ def statbar(self):
13381340
return self.GetTopLevelParent().GetStatusBar()
13391341

13401342
def set_message(self, s):
1341-
self._label_text.SetLabel(s)
1343+
if self._coordinates:
1344+
self._label_text.SetLabel(s)
13421345

13431346
def set_history_buttons(self):
13441347
can_backward = self._nav_stack._pos > 0

0 commit comments

Comments
 (0)