diff --git a/doc/api/next_api_changes/deprecations/24806-KS.rst b/doc/api/next_api_changes/deprecations/24806-KS.rst new file mode 100644 index 000000000000..4d7b1d75249b --- /dev/null +++ b/doc/api/next_api_changes/deprecations/24806-KS.rst @@ -0,0 +1,4 @@ +Deprecate unused parameter *x* to ``TextBox.begin_typing`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This parameter was unused in the method, but was a required argument. diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py index f09c7ab4b3b6..4f69f9a5bee2 100644 --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -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 diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 168562a5b774..0549f7775b96 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -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 @@ -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()