Skip to content

Commit 354f1a8

Browse files
committed
Deprecate 'x' argument for widgets.TextBox.begin_typing
This argument is a holdover from seemingly a debugging print statement that has long since been removed. It is not used internally, and was passed entirely different things in the two places it was called (once in tests, once in library code).
1 parent 9f3c6f4 commit 354f1a8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ def test_TextBox(ax, toolbar):
982982
assert tool.text == 'x**2'
983983
assert text_change_event.call_count == 1
984984

985-
tool.begin_typing(tool.text)
985+
tool.begin_typing()
986986
tool.stop_typing()
987987

988988
assert submit_event.call_count == 2

lib/matplotlib/widgets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,8 @@ def set_val(self, val):
12791279
self._observers.process('change', self.text)
12801280
self._observers.process('submit', self.text)
12811281

1282-
def begin_typing(self, x):
1282+
@_api.delete_parameter("3.7", "x")
1283+
def begin_typing(self, x=None):
12831284
self.capturekeystrokes = True
12841285
# Disable keypress shortcuts, which may otherwise cause the figure to
12851286
# be saved, closed, etc., until the user stops typing. The way to
@@ -1326,7 +1327,7 @@ def _click(self, event):
13261327
if event.canvas.mouse_grabber != self.ax:
13271328
event.canvas.grab_mouse(self.ax)
13281329
if not self.capturekeystrokes:
1329-
self.begin_typing(event.x)
1330+
self.begin_typing()
13301331
self.cursor_index = self.text_disp._char_index_at(event.x)
13311332
self._rendercursor()
13321333

0 commit comments

Comments
 (0)