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

Skip to content

Commit 0daf9d7

Browse files
authored
Merge pull request #18605 from anntzer/wxtb
Correctly sync state of wx toolbar buttons when triggered by keyboard.
2 parents a1cb2ba + 07754f0 commit 0daf9d7

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)