how to set color on GtkButton?



I've created a button that, when clicked, springs open a
GtkColorSelectionDialog. What I'd like to do is display the color on the
button, and update the color with the value returned by the dialog.

The code I've got right now to do this is as follows:

    $color = Gtk2::Gdk::Color->parse($option->{value}); # where $option->{value} is of form '#rrggbb'
    $button->modify_bg('normal', $color);
    $button->modify_bg('active', $color);
    $button->modify_bg('prelight', $color);

After the update, I do the samething, except $color is now the GdkColor
returned from $colorselectiondialog->colorsel->get_current_color. 

This doesn't work, though; the button's color isn't getting set. (I've
tried the same thing with 'modify_fg' to no avail.)

Has anyone done this successfully? Pointers?

-- 
Matthew Weier O'Phinney
http://weierophinney.net/matthew/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]