MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / begin_typing

Method begin_typing

lib/matplotlib/widgets.py:1669–1688  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1667 self._observers.process('submit', self.text)
1668
1669 def begin_typing(self):
1670 self.capturekeystrokes = True
1671 # Disable keypress shortcuts, which may otherwise cause the figure to
1672 # be saved, closed, etc., until the user stops typing. The way to
1673 # achieve this depends on whether toolmanager is in use.
1674 stack = ExitStack() # Register cleanup actions when user stops typing.
1675 self._on_stop_typing = stack.close
1676 toolmanager = getattr(
1677 self.ax.get_figure(root=True).canvas.manager, "toolmanager", None)
1678 if toolmanager is not None:
1679 # If using toolmanager, lock keypresses, and plan to release the
1680 # lock when typing stops.
1681 toolmanager.keypresslock(self)
1682 stack.callback(toolmanager.keypresslock.release, self)
1683 else:
1684 # If not using toolmanager, disable all keypress-related rcParams.
1685 # Avoid spurious warnings if keymaps are getting deprecated.
1686 with _api.suppress_matplotlib_deprecation_warning():
1687 stack.enter_context(mpl.rc_context(
1688 {k: [] for k in mpl.rcParams if k.startswith("keymap.")}))
1689
1690 def stop_typing(self):
1691 if self.capturekeystrokes:

Callers 2

_clickMethod · 0.95
test_TextBoxFunction · 0.95

Calls 2

callbackMethod · 0.80
get_figureMethod · 0.45

Tested by 1

test_TextBoxFunction · 0.76