Clipboard(3pm)
π NAME π
Tk::clipboard β manipulate the Tk clipboard, bestie. That's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
$widget->clipboardOption?(args)?
π DESCRIPTION π
Okay so this command is your little gateway to the Tk clipboard β the thing that stores data so it can be grabbed later using the selection mechanism. Think of it as the group chat's shared notes app, but make it Tk. π
Here's the tea though: to actually copy data into the clipboard, you must call clipboardClear first, and then follow it up with a sequence of one or more calls to clipboardAppend. No skipping steps, bestie, it does not work like that. π«Ά
And if you want the clipboard to be updated atomically (which you do, obviously), all of your appends need to be finished before you return to the event loop. Don't be out here leaving the clipboard half-done, it's giving chaos. π
The following methods are currently supported:
πΈ $widget->clipboardClear
Claims ownership of the clipboard on $widget's display and removes any previous contents. Returns an empty string. So basically it's the "new phone who dis" of clipboard methods β everything before is gone, and now it's yours. β¨
πΈ $widget->clipboardAppend(?-format=>format?, ?-type=>type?, ?--?, data)
Appends data to the clipboard on $widget's display in the form given by type with the representation given by format, and claims ownership of the clipboard on $widget's display. Very main character of it, honestly. π
- Type specifies the form in which the selection is to be returned (the desired "target" for conversion, in ICCCM terminology), and should be an atom name such as
STRINGorFILE_NAME; see the Inter-Client Communication Conventions Manual for complete details. Type defaults toSTRING. π - The format argument specifies the representation that should be used to transmit the selection to the requester (the second column of Table 2 of the ICCCM), and defaults to
STRING. If format isSTRING, the selection is transmitted as 8-bit ASCII characters. See theTk::Selectiondocumentation for an explanation of what happens if format is notSTRING. π
β οΈ Not me warning you: arguments passed to clipboardAppend are concatenated before conversion, so the caller must take care to ensure appropriate spacing across string boundaries. Yes, this means you can accidentally glue two words together. Ask me how I know. π
β οΈ Also: all items appended to the clipboard with the same type must have the same format. No mixing, no matching, periodt. π
- A
--argument may be specified to mark the end of options: the next argument will always be used asdata. This feature may be convenient if, for example,datastarts with a-. Lifesaver behavior, fr fr. π¦
πΈ $widget->clipboardGet( ?-type? )
Retrieve data from the clipboard on widget's display. The -type specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING. This command is equivalent to:
"SelectionGet( -selection => 'CLIPBOARD' )"
Lowkey the same thing, just cuter. πΈ
π KEYWORDS π
clear, format, clipboard, append, selection, type
And that's the whole page, bestie β brought to you by perl v5.40.1, dated 2025-04-13. Go forth and copy things, you absolute icon. ππ§β¨
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms