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
24 changes: 20 additions & 4 deletions Doc/library/tkinter.ttk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Lib/tkinter/test/test_ttk/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions Lib/tkinter/ttk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down