[Python-checkins] bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (#3667)
Serhiy Storchaka
webhook-mailer at python.org
Sun Sep 24 07:34:13 EDT 2017
https://github.com/python/cpython/commit/2fad10235460ac394cc8b869c41f47aba3d63594
commit: 2fad10235460ac394cc8b869c41f47aba3d63594
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-09-24T14:34:09+03:00
summary:
bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (#3667)
Defer removing old behavior to 3.8.
Document new feature of selection_set() and friends.
files:
M Doc/library/tkinter.ttk.rst
M Lib/tkinter/test/test_ttk/test_widgets.py
M Lib/tkinter/ttk.py
diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst
index 3dad182cccd..927f7f3c6c1 100644
--- a/Doc/library/tkinter.ttk.rst
+++ b/Doc/library/tkinter.ttk.rst
@@ -1099,26 +1099,42 @@ ttk.Treeview
If *selop* is not specified, returns selected items. Otherwise, it will
act according to the following selection methods.
+ .. deprecated-removed:: 3.6 3.8
+ Using ``selection()`` for changing the selection state is deprecated.
+ Use the following selection methods instead.
- .. method:: selection_set(items)
+
+ .. method:: selection_set(*items)
*items* becomes the new selection.
+ .. versionchanged:: 3.6
+ *items* can be passed as separate arguments, not just as a single tuple.
+
- .. method:: selection_add(items)
+ .. method:: selection_add(*items)
Add *items* to the selection.
+ .. versionchanged:: 3.6
+ *items* can be passed as separate arguments, not just as a single tuple.
+
- .. method:: selection_remove(items)
+ .. method:: selection_remove(*items)
Remove *items* from the selection.
+ .. versionchanged:: 3.6
+ *items* can be passed as separate arguments, not just as a single tuple.
- .. method:: selection_toggle(items)
+
+ .. method:: selection_toggle(*items)
Toggle the selection state of each item in *items*.
+ .. versionchanged:: 3.6
+ *items* can be passed as separate arguments, not just as a single tuple.
+
.. method:: set(item, column=None, value=None)
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
index 26766a8a1fe..ab0db2878e1 100644
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -1556,7 +1556,7 @@ def test_selection(self):
self.tv.selection_toggle((c1, c3))
self.assertEqual(self.tv.selection(), (c3, item2))
- if sys.version_info >= (3, 7):
+ if sys.version_info >= (3, 8):
import warnings
warnings.warn(
'Deprecated API of Treeview.selection() should be removed')
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index e1a965e8dff..05c7364d203 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -1404,13 +1404,13 @@ def selection(self, selop=_sentinel, items=None):
import warnings
warnings.warn(
"The selop=None argument of selection() is deprecated "
- "and will be removed in Python 3.7",
+ "and will be removed in Python 3.8",
DeprecationWarning, 3)
elif selop in ('set', 'add', 'remove', 'toggle'):
import warnings
warnings.warn(
"The selop argument of selection() is deprecated "
- "and will be removed in Python 3.7, "
+ "and will be removed in Python 3.8, "
"use selection_%s() instead" % (selop,),
DeprecationWarning, 3)
else:
More information about the Python-checkins
mailing list