Skip to content

Commit 3f78c1a

Browse files
authored
Merge pull request matplotlib#17043 from anntzer/textboxkeymapdep
Avoid spurious deprecation warning in TextBox.
2 parents 3b779df + 1aa5352 commit 3f78c1a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/widgets.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,12 +847,14 @@ def begin_typing(self, x):
847847
self.capturekeystrokes = True
848848
# Check for toolmanager handling the keypress
849849
if self.ax.figure.canvas.manager.key_press_handler_id is not None:
850-
# disable command keys so that the user can type without
851-
# command keys causing figure to be saved, etc
850+
# Disable command keys so that the user can type without
851+
# command keys causing figure to be saved, etc.
852852
self._restore_keymap = ExitStack()
853-
self._restore_keymap.enter_context(
854-
mpl.rc_context(
855-
{k: [] for k in mpl.rcParams if k.startswith('keymap.')}))
853+
# Avoid spurious warnings if keymaps are getting deprecated.
854+
with cbook._suppress_matplotlib_deprecation_warning():
855+
self._restore_keymap.enter_context(
856+
mpl.rc_context({k: [] for k in mpl.rcParams
857+
if k.startswith('keymap.')}))
856858
else:
857859
self.ax.figure.canvas.manager.toolmanager.keypresslock(self)
858860

0 commit comments

Comments
 (0)