in reply to pTk: return values of radio/check buttons
In a real situation, more likely, you would do this:use Tk; use strict; my $val; my $mw = new MainWindow; $mw->Checkbutton(onvalue => "I am selected", offvalue => "I am deselected", variable => \$val) ->pack; $mw->Entry(textvariable => \$val)->pack; MainLoop;
To check whether the Checkbutton is selected, just check whether $val is true, do something like:$mw->Checkbutton(onvalue => 1, offvalue => 0, variable => \$val);
if ($val) { ... } else { ... }
|
|---|