Name
curselection
Synopsis
L.curselection( )Returns a sequence of zero or more indices, from 0
upwards, of selected items. Depending on the underlying release of
Tk, curselection may return string representations
of the integer indices, rather than the integers themselves. To
remove this uncertainty, you can use:
indices= [ int(x) forxinL.curselection( ) ]
However,
[
L
.get(
x
)
for
x
in
L
.curselection( )] is
always the list of the zero or more text items that are selected, no
matter what form of indices curselection returns.
Therefore, if you’re interested in selected text
items rather than selected indices, the uncertainty may not be an
issue.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access