in reply to Background Color - Tk Checkbutton

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;

Replies are listed 'Best First'.
Re^2: Background Color - Tk Checkbutton
by Bintuch (Acolyte) on Jul 12, 2010 at 08:34 UTC

    It doesn't work.

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

        There is nothing uniqe in the code, but I'll post it anyhow.

        my $cb_update_actual = $FrameDataToAnalyze -> Checkbutton( -text +=>"", -offvalue=>0, -onvalue=>1, -command=> sub { if ($UpdateActual) { $entry_actual_value->configure +(-state=>"normal"); } else { $entry_actual_value->configure +(-state=>"disabled"); } }, -variable=>\$UpdateActual); $cb_update_actual -> select();