diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py index a43cfec6191f..f50402a20a15 100644 --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -619,7 +619,11 @@ def test_CheckButtons(): check.disconnect(cid) -def test_TextBox(): +@pytest.mark.parametrize("toolbar", ["none", "toolbar2", "toolmanager"]) +def test_TextBox(toolbar): + # Avoid "toolmanager is provisional" warning. + dict.__setitem__(plt.rcParams, "toolbar", toolbar) + from unittest.mock import Mock submit_event = Mock() text_change_event = Mock() diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 220fb1d280cd..a59b3b1b1677 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1287,7 +1287,7 @@ def begin_typing(self, x): # If using toolmanager, lock keypresses, and plan to release the # lock when typing stops. toolmanager.keypresslock(self) - stack.push(toolmanager.keypresslock.release, self) + stack.callback(toolmanager.keypresslock.release, self) else: # If not using toolmanager, disable all keypress-related rcParams. # Avoid spurious warnings if keymaps are getting deprecated.