in reply to radiobutton shapes sizes and colors Perl::Tk

Something like this?
#!usr/bin/perl use strict; use warnings; use Tk; my %wb; my $top = MainWindow->new(-title => 'Radiobutton'); foreach my $label (qw/Top Left Right Bottom/) { my $lower = lc $label; $wb{$lower} = $top->Radiobutton( -text => $label, -relief => 'flat', -value => $lower, -indicatoron => 0, -width => 12, -background => 'Red', -command => [\&cb_rbutton, $lower], )->pack; } Tk::MainLoop(); sub cb_rbutton { my $rb = shift; print ucfirst($rb), " is on\n"; return; }

Replies are listed 'Best First'.
Re^2: radiobutton shapes sizes and colors Perl::Tk
by pashanoid (Scribe) on Sep 15, 2011 at 09:53 UTC
    Your example is great! Thank you! However, my guy wants the radio buttons to look like radio buttons, but when checked, he wants the tiny dot within the circle to be red!&*@#
      You can use the -selectcolor option
       Name:     selectColor
             Class:    Background
             Switch:   -selectcolor
                 Specifies a background color to use when the button is selected.  If indicatorOn is true then the color applies to the indicator.
                 Under Windows, this color is used as the background for the indicator regardless of the select state.  If indicatorOn is false,
                 this color is used as the background for the entire widget, in place of background or activeBackground, whenever the widget is
                 selected.  If specified as an empty string then no special color is used for displaying when the widget is selected.
      
      
      and if that don't work for you, you can use the -image and -selectimage options to totally customize the indicator. It shouldn't be too hard, but I'll leave it to you to do, since you are the one being paid. :-) BTW, please post example code when you get it working.

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh