... wish to display number of characters input to entry in label on each keystroke ...
Here's one approach using entry input validation. I'm sure there are others and better.
c:\@Work\Perl\monks>perl -wMstrict -le
"use Tk;
use Tk::LabEntry;
;;
my $MW = tkinit;
;;
my $entrytext = '';
my $le = $MW->LabEntry(
-label => 'chars entered so far: 0',
-textvariable => \$entrytext,
-validate => 'key',
-invalidcommand => undef,
);
$le->configure(
-validatecommand => sub { showcount($le, @_) },
);
$le->pack;
;;
MainLoop;
;;
print qq{final entry: '$entrytext'};
;;
sub showcount {
my ($widget,
$newtext,
) = @_;
;;
my $label = $widget->cget(-label);
$label =~ s{ \d+ \z }{ length $newtext }xmse;
$widget->configure(-label => $label);
1;
}
"
Give a man a fish: <%-(-(-(-<