You just need to configure your notebook and tab to use the colors you want. You have to be careful what frame or widget is in the Notebook frame. For example, if you have a canvas in there, you need to change the canvas color. I've used this technique to match tab and notebook page colors in ztkdb where you can see how I juggle a hash full of colors, to make the tab and frame have the same color. You can have a hash giving values like $nb_color{$page} = 'whatever'; and load it when $page is raised.

A simpler example:

#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::NoteBook; my $mw = MainWindow->new; $mw->geometry('300x200'); my $page_tab_default_font = [-family =>'Linotype Birka', -size => 15, -weight => 'normal', -underline => 0]; my $page_tab_select_font = [-family =>'Linotype Birka', -size => 15, -weight => 'bold', -underline => 1]; my $nb_widget = $mw->NoteBook(-font=>$page_tab_default_font) ->pack(-expand=>1, -fill=>'both'); my $nb_page_01= $nb_widget->add("page1", -label=>'PAGE 1', -raisecmd=>\&raised_handler); my $nb_page_02=$nb_widget->add("page2", -label=>'PAGE 2', -raisecmd=>\&raised_handler); MainLoop; sub raised_handler { my $raised_page = print "@_\n"; my $frame = shift; print "current frame: $frame\n"; my $current = $nb_widget->raised(); print "$current is current\n"; #$nb_widget->page_widget($nb_widget->raised()); # # HOW DO I PROCEED FURTHER ????? # $frame->configure(-bg=> 'lightyellow'); $nb_widget->configure(-bg => 'lightyellow'); }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: A Perl Tk::NoteBook question by zentara
in thread A Perl Tk::NoteBook question by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.