Skip to content
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
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/24806-KS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Deprecate unused parameter *x* to ``TextBox.begin_typing``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This parameter was unused in the method, but was a required argument.
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def test_TextBox(ax, toolbar):
assert tool.text == 'x**2'
assert text_change_event.call_count == 1

tool.begin_typing(tool.text)
tool.begin_typing()
tool.stop_typing()

assert submit_event.call_count == 2
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,8 @@ def set_val(self, val):
self._observers.process('change', self.text)
self._observers.process('submit', self.text)

def begin_typing(self, x):
@_api.delete_parameter("3.7", "x")
def begin_typing(self, x=None):
self.capturekeystrokes = True
# Disable keypress shortcuts, which may otherwise cause the figure to
# be saved, closed, etc., until the user stops typing. The way to
Expand Down Expand Up @@ -1326,7 +1327,7 @@ def _click(self, event):
if event.canvas.mouse_grabber != self.ax:
event.canvas.grab_mouse(self.ax)
if not self.capturekeystrokes:
self.begin_typing(event.x)
self.begin_typing()
self.cursor_index = self.text_disp._char_index_at(event.x)
self._rendercursor()

Expand Down