Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by thundergnat (Deacon)
on Feb 08, 2013 at 18:07 UTC ( #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; } }


Comment on Re: Changing or Modifying a Tk Gui on pressing a radiobutton
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-10-22 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls