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

Backport PR #18395: TkAgg bugfix: deselect buttons that are not the current _Mode #18441

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
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
19 changes: 18 additions & 1 deletion 19 lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from matplotlib import backend_tools, cbook
from matplotlib.backend_bases import (
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
StatusbarBase, TimerBase, ToolContainerBase, cursors)
StatusbarBase, TimerBase, ToolContainerBase, cursors, _Mode)
from matplotlib._pylab_helpers import Gcf
from matplotlib.figure import Figure
from matplotlib.widgets import SubplotTool
Expand Down Expand Up @@ -538,6 +538,23 @@ def destroy(self, *args):
del self.message
tk.Frame.destroy(self, *args)

def _update_buttons_checked(self):
# sync button checkstates to match active mode
for text, mode in [('Zoom', _Mode.ZOOM), ('Pan', _Mode.PAN)]:
if text in self._buttons:
if self.mode == mode:
self._buttons[text].select() # NOT .invoke()
else:
self._buttons[text].deselect()

def pan(self, *args):
super().pan(*args)
self._update_buttons_checked()

def zoom(self, *args):
super().zoom(*args)
self._update_buttons_checked()

def set_message(self, s):
self.message.set(s)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.