in reply to Perl::Tk radiobutton yet one more time
#!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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl::Tk radiobutton yet one more time
by Anonymous Monk on Sep 22, 2011 at 09:30 UTC |