in reply to Re: Set background on Tk::Tree nodes
in thread Set background on Tk::Tree nodes

Excellent, just what I needed to know.

Follow up question: How do I use an RGB value to set the color?


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^3: Set background on Tk::Tree nodes
by pg (Canon) on Jul 18, 2005 at 03:53 UTC

    Just specify RGB in the format of '#rrggbb', for example, yellow would be '#FFFF00'.

    use Tk; use Tk::Tree; use Tk::ItemStyle; use warnings; use strict; my $main = MainWindow->new (-title => "Test tree"); my $tree = $main->ScrlTree(-itemtype => 'text', -separator => '/', -s +crollbars => "osoe"); my $yellow_style = $tree->ItemStyle('text', -refwindow => $tree, -bg = +> '#FFFF00'); my $green_style = $tree->ItemStyle('text', -refwindow => $tree, -bg => + 'green'); $tree->add(1, -text => 'abcd', -itemtype => 'text', -style => $yellow_ +style); $tree->add(2, -text => '1234', -itemtype => 'text', -style => $green_s +tyle); $tree->autosetmode; $tree->close (1); $tree->pack(-fill=>'both',-expand => 1); MainLoop;

      and again I say thank you. My workmates thank you, and I thank you. Thank you!


      Perl is Huffman encoded by design.