Pseudocode means "this is a non-functional shorthand view" of the steps you would need to take to write working code. I don't particularly like being asked to write code for someone who is getting paid for it. So here is a general purpose example, if you can't figure out the rest, you should read some books.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = MainWindow->new();
my %data;
foreach my $bank qw(aa bb cc dd){
$data{$bank}{'frame'} = $mw->Frame->pack();
$data{$bank}{'bankname'} = $bank;
$data{$bank}{'status'} = 'offline';
$data{$bank}{'label'} = $data{$bank}{'frame'}->Label(
-textvariable => \$data{$bank}{'bankname'})->pack(-side=>'left')
+;
$data{$bank}{'entry'} = $data{$bank}{'frame'}->Entry(
-textvariable => \$data{$bank}{'status'},
-bg => 'white',
)->pack(-side=>'right');
}
$mw->repeat(2000, sub{
foreach my $bank (keys %data){
my $rand = rand 10;
if ($rand > 5){
$data{$bank}{'status'} = 'online';
$data{$bank}{'entry'}->configure(-fg => 'red');
}else{
$data{$bank}{'status'} = 'offline';
$data{$bank}{'entry'}->configure(-fg => 'black');
}
}
});
MainLoop;
|