# create a ballon for this message area etc
$balloon = $tab_mw->Balloon(-statusbar => $msgarea);
# create a TopLevel widget
$toplevel_wg = $tab_mw->Toplevel();
####
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::Balloon;
my $mw = tkinit;
my $msg = 'press to change';
my $b = $mw->Button( -text => 'Power calculation',
-command => sub{$msg = $msg . ' again'},
-padx => 10,
)->pack( -side => 'top',
-anchor => 'center',
-pady => 3,
);
my $bln = $mw->Balloon( -background => 'LightYellow' )
->attach( $b, -msg =>\$msg );
MainLoop;
####
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::NoteBook;
use Tk::Balloon;
package Tk::NoteBook;
sub BalloonInfo{
my ($nb,$balloon,$X,$Y,@opt) = @_;
my $wx = $X - $nb->rootx;
my $wy = $Y - $nb->rooty;
my $tab = $nb->identify($wx,$wy);
unless ($tab){
$balloon->Deactivate;
return undef;
}
foreach my $opt (@opt)
{
my $info = $balloon->GetOption($opt,$nb);
if ($opt =~ /^-(statusmsg|balloonmsg)$/
&& (ref $info eq 'HASH')){
return $info->{$tab} if $info->{$tab} ;
}
return '';
}
}
package main;
my $mw = tkinit;
my $statuslabel = $mw->Label()->pack(-side=>'bottom');
my $b = $mw->Balloon(-statusbar=>$statuslabel);
my $nb = $mw->NoteBook()->pack;
for my $tab (qw/tab1 tab2 tab3/){
my $frame = $nb->add($tab,-label=>$tab);
$frame->Label(-text => $tab)->pack;
$frame->Label(-text => 'a Label in '.$tab)->pack;
}
$b->attach($nb,
-balloonposition => 'mouse',
-balloonmsg =>{tab1=>'Help for tab1',
tab2=>'Help for tab2',
tab3=>'Help for tab3',
},
-statusmsg =>{tab1=>'Status for tab1',
tab2=>'Status for tab2',
tab3=>'Status for tab3'},
);
MainLoop;