Hi everyone,
I'm trying to write a little "graphical" print queue monitor that's supposed to count the number of files in a certain directory and draw a line according to the number of files.
So far I managed to write a little window that draws the line as intended, but only once ...
How do I get the window to update automatically every few seconds ?
Any ideas ?
Best Regards,
Thomas
I'm trying to write a little "graphical" print queue monitor that's supposed to count the number of files in a certain directory and draw a line according to the number of files.
So far I managed to write a little window that draws the line as intended, but only once ...
How do I get the window to update automatically every few seconds ?
Code:
#!/usr/bin/perl -w
use strict;
use Tk;
my $window= MainWindow->new;
my $c1 = $window->Canvas(-background => 'saddlebrown', -width => '350', -height => '150')->pack;
$c1->createText(175, 10, -fill => 'orange', -text => 'Print Queue Monitor');
$c1->createLine(0, 20, 351, 20, -fill => 'orange');
my $jobs01=`ls -all | wc -l | awk \'{print \$1}\'`;
chomp ($jobs01);
$jobs01 +=88;
$c1->createLine(88, 65, $jobs01, 65, -width => '10', -fill => 'green');
$c1->createText(45, 65, -fill => 'orange', -text => 'Spooler Queue');
MainLoop;
Any ideas ?
Best Regards,
Thomas