Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^3: Refresh data ina entry widget

by zentara (Archbishop)
on May 29, 2008 at 19:16 UTC ( #689071=note: print w/replies, xml ) Need Help??

in reply to Re^2: Refresh data ina entry widget
in thread Refresh data ina entry widget

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;

I'm not really a human, but I play one on earth CandyGram for Mongo

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://689071]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2019-07-20 17:44 GMT
Find Nodes?
    Voting Booth?

    No recent polls found