dadenn has asked for the wisdom of the Perl Monks concerning the following question:

I am able to copy within a Perl-Tk application, but not able to paste externally to an X terminal window or a Konsole window. Within the Tk app, I am using ROText. I highlight the text with the mouse and upon Button-1 release, I have the text in a variable. I have tried the solutions in Mastering Perl-Tk, but to no avail. I may be overthinking this problem. I was under the impression that copy/paste should be pretty much automatic. I bind Button-1-release to capture the mouse event and use a callback. I have tried the clipboard commands but they don't work for me.

Does anyone have ideas or sample code that works?

I can't show the code I have, but I can say that when I copy by dragging the mouse over the characters originally, it copied nothing. I did a bind of Button-1-release and I could then capture the characters, but I could only paste within the Tk application. In your example below, you are not doing anything special, so how are you able to copy/paste outside of the script. If I unbind Button-1-release, I can't even perform the copy.

Replies are listed 'Best First'.
Re: Perl-Tk copy/paste to X terminal
by choroba (Cardinal) on Apr 30, 2015 at 14:49 UTC
    I have sample code that works. I can select the whole string or any part of it and paste it somewhere else.
    #! /usr/bin/perl use warnings; use strict; use Tk; use Tk::ROText; my $mw = 'MainWindow'->new; my $t = $mw->ROText->pack; $t->Contents('Just another Tk hacker,'); MainLoop();

    Can you show the code that doesn't work?

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ