Skip to content

Fixes an issue where WxAgg NavigationToolbar2 broke custom toolbars #18219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,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:
Expand All @@ -1131,9 +1131,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()

Expand Down Expand Up @@ -1338,7 +1340,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
Expand Down