Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Background Color - Tk Checkbutton

by Bintuch (Acolyte)
on Jul 12, 2010 at 07:16 UTC ( [id://848936]=perlquestion: print w/replies, xml ) Need Help??

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

I'm using Tk Checkbutton widget. I'm facing a small (but irritating) problem.

Whenever I hover with the Mouse over the Checkbutton, the background of the box is changing and I can't find a way to change it without changing the background of the entire widget.

I want that the background of the widget will be always gray and the box itself to be always white.

Can you help??

Replies are listed 'Best First'.
Re: Background Color - Tk Checkbutton
by shmem (Chancellor) on Jul 12, 2010 at 08:29 UTC

    Use -activebackground and -activeforeground:

    #!/usr/bin/perl use Tk; my $mw = MainWindow -> new; my $ck = $mw -> Checkbutton( -activebackground => 'gray', -activeforeground => 'black', -background => 'gray', -foreground => 'black', -text => 'Tic me', )->pack; MainLoop;

      It doesn't work.

      The background of the widget is always gray but the box itself changes from white to gray upon mouse hover.

Re: Background Color - Tk Checkbutton
by IanVand (Initiate) on Aug 30, 2012 at 21:01 UTC
    I had the same problem. Use the normal state instead of the active state.
    $your_checkbox -> configure(-state => 'normal');

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found