Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Changing or Modifying a Tk Gui on pressing a radiobutton

by thundergnat (Deacon)
on Feb 08, 2013 at 18:07 UTC ( [id://1017871]=note: print w/replies, xml ) Need Help??


in reply to Changing or Modifying a Tk Gui on pressing a radiobutton

Maybe this will give you some useful hints.

use strict; use warnings; use Tk; my %w; #widget hash $w{mw} = MainWindow->new; my $state = 'normal'; $w{fr} = $w{mw}->Frame()->pack( -expand => '1', -fill => 'x', -side => 'top' ); for ( 'normal', 'disabled', 'invisible' ) { $w{fr}->Radiobutton( -variable => \$state, -value => $_, -text => ucfirst $_, -command => sub { change( $state, $w{fr2} ) } )->pack( -side => 'left' ); } $w{fr2} = $w{mw}->Frame()->pack( -expand => '1', -fill => 'both', -side => 'top' ); for ( 1 .. 10 ) { $w{fr2}->Label( -text => "Label $_" )->grid( -row => $_, -column = +> 0 ); $w{fr2}->Entry()->grid( -row => $_, -column => 1 ); } MainLoop; sub change { my ( $state, $widget ) = @_; if ( $state eq 'invisible' ) { $widget->packForget } else { $widget->pack; $_->configure( -state => $state ) for $widget->children; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-24 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found