Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Does the active background color of the circle of a Tk radio button have to be the same as that of the textual string?

by ZJ.Mike.2009 (Scribe)
on Jul 09, 2011 at 06:15 UTC ( #913492=perlquestion: print w/replies, xml ) Need Help??

ZJ.Mike.2009 has asked for the wisdom of the Perl Monks concerning the following question:

A radiobutton is a widget that has a textual string and a circle. In the following code, without the mouse hovering on the radiobutton, the background colors of the circle and the text are white and khaki separately. With the mouse hovering, the background colors of the circle and the text are both khaki. Is there a way to make the background color of the circle stay white? Or is this some kind of compatibility issue with Tk running on Windows (I'm running Tk 804.29 with ActivePerl 5.12.1 on Win XP)? A WxPerl radiobutton does not seem to give me this problem.
use strict; use warnings; use Tk; my $mw = MainWindow -> new(); my $frame = $mw -> Frame()-> pack( ); my $id = 0; my $bg_color = 'khaki'; my $radio_button1 = $frame -> Radiobutton ( -text => 'RadioButton1', -value =>0, -variable => \$id, -bg => $bg_color, -activebackground => $bg_color, -activeforeground => 'red', ) -> pack (); my $radio_button2 = $frame -> Radiobutton ( -text => 'RadioButton1', -value =>1, -variable => \$id, -bg => $bg_color, -activebackground => $bg_color, -activeforeground => 'red', ) -> pack (); MainLoop;
  • Comment on Does the active background color of the circle of a Tk radio button have to be the same as that of the textual string?
  • Download Code

Replies are listed 'Best First'.
Re: Does the active background color of the circle of a Tk radio button have to be the same as that of the textual string?
by zentara (Archbishop) on Jul 09, 2011 at 14:52 UTC
Re: Does the active background color of the circle of a Tk radio button have to be the same as that of the textual string?
by Anonymous Monk on Jul 09, 2011 at 14:39 UTC

    Is there a way to make the background color of the circle stay white?

    Sure, create your own radiobutton widget, one made of two radio buttons, one with activecolor specified, one without -- check cpan, somebody might have already done it

    Or is this some kind of compatibility issue with Tk running on Windows (I'm running Tk 804.29 with ActivePerl 5.12.1 on Win XP)?

    I doubt it, but I can't confirm (I only have win32)

    A WxPerl radiobutton does not seem to give me this problem.

    Not exactly relevant :) wxRadioButton doesn't have an activecolor option either, and not being able to set color for the check/radio is considered a bug #10137 ([MSW-XP] wxRadioButton::SetForegroundColour doesn’t work) – wxWidgets

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-02-06 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (33 votes). Check out past polls.

    Notices?