#!usr/bin/perl use strict; use Tk; my $top = MainWindow->new; my $color = qw/Green Blue Yellow Red White/; my @wb; $wb[0] = $top->Radiobutton( -variable => \$color, -command => [\&cb_rbutton, $top], -text => 'Green', -value => 'green')->pack( -side => 'top', -anchor => 'w'); $wb[1] = $top->Radiobutton( -variable => \$color, -command => [\&cb_rbutton, $top], -text => 'Blue', -value => 'blue')->pack( -side => 'top', -anchor => 'w'); $wb[2] = $top->Radiobutton( -variable => \$color, -command => [\&cb_rbutton, $top], -text => 'Yellow', -value => 'yellow')->pack( -side => 'top', -anchor => 'w'); $wb[3] = $top->Radiobutton( -variable => \$color, -command => [\&cb_rbutton, $top], -text => 'Red', -value => 'red')->pack( -side => 'top', -anchor => 'w'); $wb[4] = $top->Radiobutton( -variable => \$color, -command => [\&cb_rbutton, $top], -text => 'White', -value => 'white')->pack( -side => 'top', -anchor => 'w'); Tk::MainLoop(); sub cb_rbutton { my $rb = shift; print "$color is on\n"; return; }
In reply to Re: Perl::Tk radiobutton yet one more time
by Khen1950fx
in thread Perl::Tk radiobutton yet one more time
by pashanoid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |