Any suggestestions?
Just from looking at my Tk test scripts, you should look at Tk::DynaTabFrame or look at the script below, where you may be able to switch tab titles, by examing the following, and doing some juggling. :-)
#!/usr/bin/perl
use Tk;
use Tk::NoteBook;
use Tk::Photo;
use Tk::Compound;
use strict;
my $mw=tkinit;
my @tabs = qw/One Two Three/;
my $nb=$mw->NoteBook(
-font => "Arial 24",
-background=>'lightgreen',
-inactivebackground => "lightgray",
-tabpadx => 5,
-tabpady => 5,
)->pack;
my $c = $mw->Compound(-foreground=>'black',-bg=>'red',-showbackground=
+>1);
$c->Text(-text => "Four", -font => "Arial 24");
foreach my $title (@tabs){
$nb->add($title,-label=>$title);
}
$nb->add("Four",-image => $c);
my $id = $mw->repeat(500,sub{&chgtab($tabs[3])});
$nb->bind('<ButtonRelease-1>', [\&killtimer,Ev('x'),Ev('y')]);
MainLoop;
sub killtimer{
my ($w,$x,$y) = @_;
my $tab = $w->identify($x,$y);
if ($tab eq "Four"){
$nb->pageconfigure($tab,-label=>$tab);
$c->configure(showbackground=>0);
$id->cancel;
}
}
sub chgtab {
$c->configure(-showbackground=>!$c->cget(-showbackground));
}
|