Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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 ????? # }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A Perl Tk::NoteBook question
by zentara (Cardinal) on Jul 09, 2014 at 14:50 UTC | |
by Anonymous Monk on Jul 09, 2014 at 15:27 UTC | |
by zentara (Cardinal) on Jul 09, 2014 at 15:55 UTC | |
by Anonymous Monk on Jul 10, 2014 at 06:10 UTC | |
by zentara (Cardinal) on Jul 10, 2014 at 09:48 UTC | |
|