Maybe something like:
use strict;
use warnings;
use Tk;
my $MW = tkinit;
my $show_button_text = 'txt';
my $show_button = $MW->Button(
-textvariable => \$show_button_text,
-command => sub { print "$show_button_text \n"; },
)->pack(qw(-side top -fill x));
my %add_buttons;
for my $add_text (qw(a bb xyz)) {
$add_buttons{$add_text} = $MW->Button(
-text => $add_text,
-command => sub { $show_button_text .= " $add_text"; },
)->pack(qw(-side left -expand 1));
}
MainLoop;
Instead of printing, clicking
$show_button might do the copy to the other widget. Tested under Strawberry Perl 5.8.9.5 (32-bit).
(Update: Also works under Strawberry 5.30.3.1 64-bit.)
Give a man a fish: <%-{-{-{-<