in reply to Tk - Tick box size change
Your options seem to be either to supply your own images for the checked and unchecked checkboxes to Checkbutton or use a different checkbutton object. I found Tk::Checkbox has the option of setting the size. I don't see how to add text next to it so you likely will need to add your own label.
use warnings; use strict; use Tk; use Tk::Checkbox; my $mw = MainWindow->new(-title => 'CheckBox size'); my $f = $mw->Frame->pack(-side => 'top'); my $weight1 = "normal"; my $fch = $f->Checkbutton( -text => "Weight", -variable => \$weight1, )->pack(-side => 'left'); my $size = 16; $fch->configure(-font => [ -size => $size ]); my $weight2 = "Weight"; my $fch2 = $f->Checkbox( -variable => \$weight2, -command => sub {print "$weight2\n"}, -onvalue => "Weight", -offvalue => "Mass", -size => 25, )->pack(-side => 'left'); MainLoop;
I found it was tricky to install Tk::Checkbox in CPAN since install Tk::Checkbox doesn't work and i /Tk::Checkbox/ doesn't find anything. I had to use install MIKRA/Tk-MK-0.23.tar.gz.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk - Tick box size change
by merrymonk (Hermit) on Mar 13, 2019 at 20:31 UTC | |
by Lotus1 (Vicar) on Mar 14, 2019 at 14:03 UTC |