Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d13d2d

Browse files
authored
Merge pull request #24806 from ksunden/begin_typing_arg
Deprecate 'x' argument for widgets.TextBox.begin_typing
2 parents ab364af + 32cac5c commit 1d13d2d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Deprecate unused parameter *x* to ``TextBox.begin_typing``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
This parameter was unused in the method, but was a required argument.

lib/matplotlib/tests/test_widgets.py

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

987-
tool.begin_typing(tool.text)
987+
tool.begin_typing()
988988
tool.stop_typing()
989989

990990
assert submit_event.call_count == 2

lib/matplotlib/widgets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,8 @@ def set_val(self, val):
13381338
self._observers.process('change', self.text)
13391339
self._observers.process('submit', self.text)
13401340

1341-
def begin_typing(self, x):
1341+
@_api.delete_parameter("3.7", "x")
1342+
def begin_typing(self, x=None):
13421343
self.capturekeystrokes = True
13431344
# Disable keypress shortcuts, which may otherwise cause the figure to
13441345
# be saved, closed, etc., until the user stops typing. The way to
@@ -1385,7 +1386,7 @@ def _click(self, event):
13851386
if event.canvas.mouse_grabber != self.ax:
13861387
event.canvas.grab_mouse(self.ax)
13871388
if not self.capturekeystrokes:
1388-
self.begin_typing(event.x)
1389+
self.begin_typing()
13891390
self.cursor_index = self.text_disp._char_index_at(event.x)
13901391
self._rendercursor()
13911392

0 commit comments

Comments
 (0)