Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Tooltips for Tk widgets in perl - easier than ever

by zentara (Archbishop)
on Jul 13, 2007 at 12:17 UTC ( [id://626422]=note: print w/replies, xml ) Need Help??


in reply to Tooltips for Tk widgets in perl - easier than ever

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

Replies are listed 'Best First'.
Re^2: Tooltips for Tk widgets in perl - easier than ever
by vkon (Curate) on Jul 14, 2007 at 16:12 UTC
    all true.

    However, perl/Tk limits to Tix's Balloons, whereas in Tcl/Tk there is larger choice of different "tooltip" widgets, so allowing better TIMTOWTDI principle.

    Best regards,
    Vadim.

      Yeah. someone has to keep people aware of the virtues of Tcl/TK ...... it's good, but Tcl is not Perl, thats it's drawback in my book.

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
        I, for one, think its not good to recommend Tcl::Tk to novices, because this approach requires deeper knowledge on what is happening, and one should be prepared to unexpected

        But I don't understand your argumentation that "Tcl is not Perl" as drawback.
        Its quite common to use external library of something, even if that library is not Perl.
        Why the limitation?

        just for the record, Ruby+Tk, Python+Tk, Perl+Gtk2, etc, etc all use external non-perl libraries.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://626422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found