Hope this demo can help you to understand:
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;
In a real situation, more likely, you would do this:
$mw->Checkbutton(onvalue => 1,
offvalue => 0,
variable => \$val);
To check whether the Checkbutton is selected, just check whether $val is true, do something like:
if ($val) {
...
} else {
...
}
|