Gtk2 has similar ease of adding tooltips to any widget:
my $tooltip1 = Gtk2::Tooltips->new; my $tip_text1 = 'Just Another Exit Button'; $tooltip1->set_tip($button, $tip_text1, undef);

and it's not really that much harder in Perl/Tk. The real difficulty with balloons comes, when you need to dynamically change them at post time.

#!/usr/bin/perl #by Jack D. # Just attach the balloon to the widget itself instead # of treating it like a canvas item. # The script below shows both. ## Example ## use Tk; use Tk::Balloon; use strict; my $mw=tkinit; my $c=$mw->Canvas->pack; my $l = $c->Label(-relief=>'sunken',-text=>'embedded window'); $c->create('window',150,150,-window=>$l); $c->create('text', 150,100,-text=>"A Text Canvas Item",-tags=>'TESTTAG +'); my $ba = $mw->Balloon(-background=>'yellow'); $ba->attach($l,-initwait=>0,-balloonmsg=>'Attached to Widget'); $ba->attach($c, -initwait=>0, -balloonposition => 'mouse', -msg=>{ 'TESTTAG'=>'A Canvas Item'} ); MainLoop; __END__

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Tooltips for Tk widgets in perl - easier than ever by zentara
in thread Tooltips for Tk widgets in perl - easier than ever by vkon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.