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 56504fa

Browse filesBrowse files
committed
Implement set_history_buttons for Tk toolbar.
This makes the backward/forward buttons change enabled state based on whether there are actually old/new views available.
1 parent 100c7cf commit 56504fa
Copy full SHA for 56504fa

File tree

Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,16 @@ def save_figure(self, *args):
620620
except Exception as e:
621621
tkinter.messagebox.showerror("Error saving file", str(e))
622622

623+
def set_history_buttons(self):
624+
if self._nav_stack._pos > 0:
625+
self._buttons['Back']['state'] = tk.NORMAL
626+
else:
627+
self._buttons['Back']['state'] = tk.DISABLED
628+
if self._nav_stack._pos < len(self._nav_stack._elements) - 1:
629+
self._buttons['Forward']['state'] = tk.NORMAL
630+
else:
631+
self._buttons['Forward']['state'] = tk.DISABLED
632+
623633

624634
class ToolTip:
625635
"""

0 commit comments

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