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

Skip to content

Commit 4eb188a

Browse files
committed
Make Qt toolbar more resilient against removal of tool buttons.
1 parent 085504f commit 4eb188a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,10 @@ def edit_parameters(self):
753753

754754
def _update_buttons_checked(self):
755755
# sync button checkstates to match active mode
756-
self._actions['pan'].setChecked(self._active == 'PAN')
757-
self._actions['zoom'].setChecked(self._active == 'ZOOM')
756+
if 'pan' in self._actions:
757+
self._actions['pan'].setChecked(self._active == 'PAN')
758+
if 'zoom' in self._actions:
759+
self._actions['zoom'].setChecked(self._active == 'ZOOM')
758760

759761
def pan(self, *args):
760762
super().pan(*args)

0 commit comments

Comments
 (0)