I've included a little program here.  What I'm trying to do is run a timer when no keyboard or mouse activity is active.
As soon as something happens reset my timer.  Ideally it would target a window that isn't associated with this window,
but since its just a helper for me as long as the bind works outside the program window that is good enough.

So the question is what bind command would include any keyboard or mouse event?
How do I expand the bind outside the timer window?
How do I start Perl Tk jobs without the CMD window also spawning?

#!/usr/bin/perl
use warnings;
use strict;
use Tk;

my $a=0;
my $MainWindow = MainWindow->new();
$MainWindow->minsize( qw(150 40) );
my $topFrame = $MainWindow->Frame->pack(-side=>'top',-fill=>'x');
my $timerWindow = $topFrame->Label(-background="">
$timerWindow->configure(-text => $a);
$MainWindow->bind("<1>",\&Change);
timerStart();
MainLoop;

sub Change
{
    $a=0;
}

sub timerStart
{
   $timerWindow->repeat(1000,sub {$timerWindow->configure(-text => $a++)});
}
exit;

Basil
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to