Clipboard#

Every widget can read and write the system clipboard — the buffer behind copy and paste. For a worked copy/paste flow, see Copy to the clipboard.

The canonical upstream reference is the Tk clipboard manual page (Tcl 8.6).

clipboard_clear()

Empty the clipboard. Call this before appending a fresh value.

Returns:

None.

clipboard_append(string)

Add text to the clipboard (after clipboard_clear for a clean replace).

Parameters:

string (str) – the text to place on the clipboard.

Returns:

None.

clipboard_get()

Return the clipboard’s current text.

Returns:

the clipboard contents.

Return type:

str

Raises:

TclError – if the clipboard is empty.