Skip to content

Backport PR #20997 on branch v3.5.x (Fix ToolManager + TextBox support.) #21000

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
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion lib/matplotlib/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down