Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

radiobutton shapes sizes and colors Perl::Tk

by pashanoid (Scribe)
on Sep 15, 2011 at 07:10 UTC ( [id://926085]=perlquestion: print w/replies, xml ) Need Help??

pashanoid has asked for the wisdom of the Perl Monks concerning the following question:

Dear Bretheren, I made a mistake of sending a screenshot of my perl tk app running on Linux to my boss. Now, he hates the standard windows circles with black dots and wants Linux - like squares with red inserts. I'm going nuts with this... Is it possible? Is there a way to make the radiobutton dot red? on windows? Thank you and sorry for the silly question!

  • Comment on radiobutton shapes sizes and colors Perl::Tk

Replies are listed 'Best First'.
Re: radiobutton shapes sizes and colors Perl::Tk
by Khen1950fx (Canon) on Sep 15, 2011 at 08:43 UTC
    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; }
      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
Re: radiobutton shapes sizes and colors Perl::Tk
by halley (Prior) on Sep 15, 2011 at 10:24 UTC
    It's a standard widget in the guts of Tk. Perhaps the custom red dot is going to increase profits or save lives, but I really doubt it. Ask him if reinventing the wheel to implement whims is seriously worth your hourly pay rate.

    --
    [ e d @ h a l l e y . c c ]

      Yes, it really is okay to tell someone, "after due and careful consideration" (show him a printout of this thread) "the best business-answer is: 'no.'" And let's face it, the first part of a request "can we do this?" is ... "CAN we do this?"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://926085]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-23 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found