Hello Monks,
I am rewriting a Tk program for Gtk2+. I am trying to set the background color of a widget (actually, its container) to white. But I can't figure out how. I have Googled all over, with no success, so I come here.
I have no trouble setting the foreground color. I'm thinking it might have to do with "color map" "channels"(?), but this is all way over my head. Here is what I've done so far:
# this will yield Medium Blue
my $red = 0x0000;
my $green = 0x0000;
my $blue = 0xffff;
my $fgColor = Gtk2::Gdk::Color->new($red, $green, $blue);
my $red = 0xffff;
my $green = 0xffff;
my $bgColor = Gtk2::Gdk::Color->new($red, $green, $blue);
my $state = 'normal';
my $title = Gtk2::Label->new('The Big Show');
$title->modify_fg($state, $fgColor); # works
$title->modify_bg($state, $bgColor); # doesn't work
If I set_markup with a span tag, and set background="white", it works, but looks ugly because the entire container background is not white, just the letters.
I have also tried to modify the bgColor of the HBox, and the Frame that contains it, but that doesn't seem to be supported.
Finally, I've tried playing with RC Style, but here I get really lost:
my $rcStyle = Gtk2::RcStyle->new();
my $rcColor = $rcStyle->fg($state, $fgColor);
my $rcBgColor = $rcStyle->bg($state, $bgColor);
Maybe I need to use Pango methods?? Can anyone point me in the right direction?
Thanks so much,
Ray
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.