Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5601f5a

Browse filesBrowse files
authored
Merge pull request #22082 from anntzer/wzp
Update both zoom/pan states on wx when triggering from keyboard.
2 parents bf3c651 + e7744cf commit 5601f5a
Copy full SHA for 5601f5a

File tree

1 file changed

+8
-4
lines changed
Filter options

1 file changed

+8
-4
lines changed

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,15 +1134,19 @@ def _icon(name):
11341134
def get_canvas(self, frame, fig):
11351135
return type(self.canvas)(frame, -1, fig)
11361136

1137+
def _update_buttons_checked(self):
1138+
if "Pan" in self.wx_ids:
1139+
self.ToggleTool(self.wx_ids["Pan"], self.mode.name == "PAN")
1140+
if "Zoom" in self.wx_ids:
1141+
self.ToggleTool(self.wx_ids["Zoom"], self.mode.name == "ZOOM")
1142+
11371143
def zoom(self, *args):
1138-
tool = self.wx_ids['Zoom']
1139-
self.ToggleTool(tool, not self.GetToolState(tool))
11401144
super().zoom(*args)
1145+
self._update_buttons_checked()
11411146

11421147
def pan(self, *args):
1143-
tool = self.wx_ids['Pan']
1144-
self.ToggleTool(tool, not self.GetToolState(tool))
11451148
super().pan(*args)
1149+
self._update_buttons_checked()
11461150

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.