Hello Perl Folks,

I'm interested to know,

(A) if it's possible in Perl Tk to change the font of the text string displayed on page-tab of Tk::NoteBook whenever that particular page is raised. i.e. in comparison to other page tabs the currently raised page should have it's text string displayed in bold as well as underlined.

(B) Also is it possible to change the foreground color of this text string (to say 'blue') only when raised ?

Here's a sample code I've written.

I guess the problem I'm facing is, the NoteBook object is of type Tk::Widget while the page tabs are of type Tk::Frame and the text string in page tab is not a Tk::Label object so that I can change it's font and color. The text string in the page tab is created via the -label option in Tk::NoteBook widget and I'm unable to get a handle on it so that I can change it's font and color.
Any solution or workaround will be helpful.
PS: I'm using Tk version: 804.032 on Windows XP

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 = $nb_widget->page_widget($nb_widget->raised()); # # HOW DO I PROCEED FURTHER ????? # }


In reply to 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.