Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0addc9

Browse files
authored
Merge pull request #18229 from meeseeksmachine/auto-backport-of-pr-18219-on-v3.3.x
Backport PR #18219 on branch v3.3.x (Fixes an issue where WxAgg NavigationToolbar2 broke custom toolbars)
2 parents b604dec + 0468005 commit c0addc9

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
@@ -1105,7 +1105,7 @@ def _set_frame_icon(frame):
11051105

11061106

11071107
class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
1108-
def __init__(self, canvas):
1108+
def __init__(self, canvas, coordinates=True):
11091109
wx.ToolBar.__init__(self, canvas.GetParent(), -1)
11101110

11111111
if 'wxMac' in wx.PlatformInfo:
@@ -1127,9 +1127,11 @@ def __init__(self, canvas):
11271127
self.Bind(wx.EVT_TOOL, getattr(self, callback),
11281128
id=self.wx_ids[text])
11291129

1130-
self.AddStretchableSpace()
1131-
self._label_text = wx.StaticText(self)
1132-
self.AddControl(self._label_text)
1130+
self._coordinates = coordinates
1131+
if self._coordinates:
1132+
self.AddStretchableSpace()
1133+
self._label_text = wx.StaticText(self)
1134+
self.AddControl(self._label_text)
11331135

11341136
self.Realize()
11351137

@@ -1334,7 +1336,8 @@ def statbar(self):
13341336
return self.GetTopLevelParent().GetStatusBar()
13351337

13361338
def set_message(self, s):
1337-
self._label_text.SetLabel(s)
1339+
if self._coordinates:
1340+
self._label_text.SetLabel(s)
13381341

13391342
def set_history_buttons(self):
13401343
can_backward = self._nav_stack._pos > 0

0 commit comments

Comments
 (0)