#!/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(-expand=>1, -fill=>'both'); my $c = $mw->Compound(-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('', [\&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)); } __END__