in reply to Re: PERL Tk label(-textvariable))
in thread PERL Tk label(-textvariable))
use strict; use warnings; use Tk; use POSIX; my $red; my $green; my $blue; my $mw = MainWindow->new; $mw->title('Raw Renamer'); my $right_frame = $mw->Label->pack(-side => 'left', -anchor => 'n', -e +xpand => 1); my $text_frame = $right_frame->Label->pack(-side => 'left', -anchor => + 'n', -expand => 1); $text_frame->Label(-text =>"Red")->pack(-side => 'top', -anchor => 'w' +); $text_frame->Label(-text =>"Green")->pack(-side => 'top', -anchor => ' +w'); $text_frame->Label(-text =>"Blue")->pack(-side => 'top', -anchor => 'w +'); my $variable_frame = $right_frame->Label->pack(-side => 'left', -ancho +r => 'n', -expand => 1); my $red_frame = $variable_frame->Label(-textvariable =>\$red)->pack(-s +ide => 'top'); my $green_frame = $variable_frame->Label(-textvariable =>\$green)->pac +k(-side => 'top'); my $blue_frame = $variable_frame->Label(-textvariable =>\$blue)->pack( +-side => 'top'); Intialize(); MainLoop; sub Intialize { while(1) { $red = floor(5*rand()); $red_frame->update; sleep 1; $green = floor(5*rand()+10); $green_frame->update; sleep 1; $blue = floor(5*rand()+20); $blue_frame->update; sleep 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: PERL Tk label(-textvariable))
by fishmonger (Chaplain) on Aug 26, 2015 at 19:33 UTC | |
by State_Space (Acolyte) on Aug 26, 2015 at 19:52 UTC |