Home: Perl Programming Help: Intermediate:
Perl/Tk: Clearing Widgets Inside a Frame



Claude2005
Novice

Aug 4, 2011, 6:00 PM


Views: 1536
Perl/Tk: Clearing Widgets Inside a Frame

Hello there,

I was wondering if there's a way to clear widgets inside a frame. I intend to put the code inside the ClearAll subroutine.


Code
use strict; 
use Tk;
my $mw = MainWindow -> new;
my $f = $mw -> Frame() -> pack();
for (1..5) {
$f -> Label ( -text => $_ ) -> pack();
}
$f = $mw -> Button ( -text => 'Clear', -command => \&ClearAll )
-> pack();
MainLoop;

sub ClearAll {

}


Thanks in advance


(This post was edited by Claude2005 on Aug 4, 2011, 6:01 PM)


wickedxter
User

Aug 31, 2011, 6:25 PM


Views: 1447
Re: [Claude2005] Perl/Tk: Clearing Widgets Inside a Frame

 
you can clear widgets just tie a -variable to it, b/c it gets set to the value of the widget so if you alter the state of that variable it will change whats soon after you do an update...