use strict; use warnings; use Tk; use Tk::Text; use Tk::Balloon; my $mw = tkinit(); my $text = $mw->Text()->pack(); $text->insert('end',"This is a red text\n"); $text->tagAdd('red_text',"1.10","1.13"); $text->insert('end',"This is a black text\n"); $text->tagConfigure('red_text', -foreground => 'red'); my $balloon = $text->Balloon(); $balloon ->attach($text , -balloonmsg => "hello", -initwait=>10); $mw->MainLoop();