Tk::Checkbox - Yet Another Checkbutton widget |
Tk::Checkbox - Yet Another Checkbutton widget (with a sizable marker)
use Tk; use Tk::Checkbox;
my $var = 'Up'; my $mw = MainWindow->new();
my $cb1 = $mw->Checkbox ( -variable => \$var, -command => \&test_cb, -onvalue => 'Up', -offvalue => 'Down', #-noinitialcallback => '1', #-size => '8', )->pack; Tk::MainLoop; sub test_cb { print "test_cb called with [@_], \$var = >$var<\n"; }
Another check button style widget that uses a check mark in a fixed box. Useful as a boolean field. It's based on Damion K. Wilson's version from Tk-DKW-0.03, suitable for perl Tk800.x (developed with Tk800.024).
You can tie a scalar-value to the Checkbox widget, enable/disable it, assign a callback, that is invoked each time the Checkbox is changed, as well as set ON- and OFF-values and configure any of the options understood by Tk::Frame(s) like -relief, -bg, ... .
You should prefer interacting with the widget via a variable.
Michael Krause, KrauseM_AT_gmx_DOT_net
This code may be distributed under the same conditions as Perl.
V2.8 (C) September 2011
Tk::Checkbox - Yet Another Checkbutton widget |