Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Tk - Tick box size change

by Lotus1 (Vicar)
on Mar 13, 2019 at 19:06 UTC ( [id://1231234]=note: print w/replies, xml ) Need Help??


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
    Thank you. I was hoping it would have been more straightforward however, I will try and use what you have suggested.

      It looks like you can also place buttons on a canvas and then scale the canvas. I don't have time to dig into this and there are monks around who are experienced with Perl/Tk who might be able to provide an example.

      Edit: Here is a Perlmonks node that deals with scaling canvases but not really scaling buttons. It might give you something to go on.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231234]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-25 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found