use warnings; use strict; use Tk; use Tk::Balloon; my $mw = tkinit; my $can = $mw->Canvas->pack; $can->createRectangle(10,10,100,100,-fill=>'red'); my $left = $can->createRectangle(10,10,50,100, -stipple => 'transparent', -fill => 'black', -outline => '', -tags => ['left'], ); $can->bind($left,'<1>',sub{ $mw->messageBox(-message => 'you clicked the left side!'); }); my $b = $mw->Balloon(); $b->attach($can, -balloonposition => 'mouse', -msg => {'left' => 'click here for a message', }, ); MainLoop;