Selection#
The selection is the highlighted text shared between applications (the
PRIMARY selection on X11; also used for a widget’s own highlighted range).
These methods read it, clear it, and claim ownership of it.
The canonical upstream reference is the Tk selection manual page (Tcl 8.6).
- selection_get(**kw)
Return the current selection.
- selection_clear(**kw)
Clear the selection this widget owns.
- Parameters:
kw –
selection=names which selection to clear.- Returns:
None.
- selection_own(**kw)
Make this widget the owner of the selection.
- Parameters:
kw –
selection=names which selection to claim;command=a callback invoked if ownership is later lost.- Returns:
None.
- selection_own_get(**kw)
Return the widget that currently owns the selection.
- Parameters:
kw –
selection=names which selection to query.- Returns:
the owning widget.
- Return type:
Misc
- Raises:
TclError – if no widget in this application owns it.
- selection_handle(command, **kw)
Supply the selection’s contents on demand: register
commandto be called when another application asks this widget for the selection it owns. Tk calls it with an offset and a maximum byte count, and it returns that slice of the value. Use it when the selection is large or generated — for a plain string, owning the selection is enough.- Parameters:
command – called as
command(offset, length); returns the requested slice as a string.kw –
selection=names which selection,type=the target form.
- Returns:
None.