Skip to content

Commit 07754f0

Browse files
committed
Correctly sync state of wx toolbar buttons when triggered by keyboard.
Previously, pressing "p" would unclick the "Pan" button if it was already pressed, but not press it if it wasn't (even though it did correctly start panning). Fix that.
1 parent 5173cda commit 07754f0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,12 +1179,14 @@ def get_canvas(self, frame, fig):
11791179
return type(self.canvas)(frame, -1, fig)
11801180

11811181
def zoom(self, *args):
1182-
self.ToggleTool(self.wx_ids['Pan'], False)
1183-
NavigationToolbar2.zoom(self, *args)
1182+
tool = self.wx_ids['Zoom']
1183+
self.ToggleTool(tool, not self.GetToolState(tool))
1184+
super().zoom(*args)
11841185

11851186
def pan(self, *args):
1186-
self.ToggleTool(self.wx_ids['Zoom'], False)
1187-
NavigationToolbar2.pan(self, *args)
1187+
tool = self.wx_ids['Pan']
1188+
self.ToggleTool(tool, not self.GetToolState(tool))
1189+
super().pan(*args)
11881190

11891191
def save_figure(self, *args):
11901192
# Fetch the required filename and file type.

0 commit comments

Comments
 (0)