What you want can be achieved using Tk::after and the -textvariable option (see Tk::options) most widgets support (like buttons, lables, ...). Here is an example:
#!/usr/bin/perl -w
use strict;
use Tk 8;
use vars qw/ $VARIABBBBBBB $TIMER /;
my $MWin = new Tk::MainWindow(-background=>'green',
-width=>400,
-height=>400
,);
$MWin->Label(-textvariable => \$VARIABBBBBBB,
-relief => 'flat',
,)->pack();
$MWin->Button(-text => "BUTT On",
-relief => 'groove',
-borderwidth => 2,
-padx => 3,
-pady => 3,
-command => \&ffffffff,
,)->pack();
&MainLoop();
sub ffffffff
{
$TIMER->cancel() if $TIMER;
$VARIABBBBBBB = 0;
$TIMER = $MWin->repeat(100, sub { $VARIABBBBBBB++});
}
Also, I am reccomending to everybody to go and read How to RTFM, it's a lifesaver.
| [reply] [d/l] |
crazyinsomniac
Many thanks. Me thinks that if Tk::After had been called Tk::Repeat I might have spotted it while trawling through the manual. Anyways your example is great, thanks for giving me your time.
readey.
| [reply] |