[New-bugs-announce] [issue27319] Multiple item arguments for selection operations

Serhiy Storchaka report at bugs.python.org
Tue Jun 14 13:41:00 EDT 2016

New submission from Serhiy Storchaka:

For now methods selection_set(), selection_add(), selection_remove() and selection_toggle() of ttk.TreeView take the single argument that should be either the single item id or a tuple or list of item ids. In contrary methods delete() and detach() take item ids as a variable number of arguments. The latter interface looks more pythonic, more consistent and errorproof.

Proposed patch (based on Terry's suggestion in issue26386) makes selection methods accepting a variable number of arguments. For compatibility with older versions a tuple or list of item ids can be specified as a single argument, but this interface is deprecated (with long deprecation period).

In addition deprecated other weird interface. For now the selection() method can take a subcommand name and items, for example tv.selection('add', 'ITEM1'). If the first argument is None, arguments are ignored, tv.selection(None, 'spam') equals to tv.selection(). Now all this is deprecated and will be TypeError in 3.7.

components: Library (Lib), Tkinter
files: treeview_selection_items.patch
keywords: patch
messages: 268574
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Multiple item arguments for selection operations
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43390/treeview_selection_items.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list