Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

[Tkx] Tk's Balloon translation

by sebapabst (Acolyte)
on Feb 21, 2010 at 15:27 UTC ( #824504=perlquestion: print w/replies, xml ) Need Help??
sebapabst has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!
I've still got a problem. I was looking for a way to apply an explanatory comment to an entry or a label widget when the mouse is "hover" it. Zentara told me that in Tk that's named Balloon. It's part of the Tk's Tix extension. I found how to apply it in tk, but the GUI I'm greating uses Tkx, and I really can't make the translation from Tk to Tkx.
I can't understand why. I've tried every combination: i've required the package Balloon, etc, but it always gives me an error. Balloon is not recognised. So I would like to know if there's another rule to translate on Tkx the tk's extentions or if tkx doesn't support Ballons, or this widget got another name or what else.

Just in case, Tk's code is the following :

use Tk; use Tk::Balloon; $mw = MainWindow->new(-title => "Simple Balloon example"); $button = $mw->Button(-text => "Exit", -command => sub { exit })->pack +; $msgarea = $mw->Label(-borderwidth => 2, -relief => 'groove') ->pack(-side => 'bottom', -fill => 'x'); $balloon = $mw->Balloon(-statusbar => $msgarea); $balloon->attach($button, -balloonmsg => "Exit the App", -statusmsg => "Press the Button to exit the application"); $balloon->attach($msgarea, -msg => 'Displays the help text for a widge +t'); MainLoop;

Thanks for helping me!

Replies are listed 'Best First'.
Re: [Tkx] Tk's Balloon translation
by biohisham (Priest) on Feb 21, 2010 at 16:09 UTC
    zentara gave you the Tk nomenclature for the feature you seek in his reply. In Tkx nomenclature this feature is called "tooltip" and not "balloon".

    Quoting using Tcl packages from Tkx::Tutorial:

    "When the Perl application starts up and loads Tkx, the only functions available in the Tkx:: namespace are those commands provided by core Tcl/Tk."
    and that additional commands can be loaded hence you need to load the tooltip utility and provide it to "Tkx::package_require()".

    I am not familiar with Tkx myself, but I suggest that you read Tkx::Tutorial and go through CPAN too.

    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.
      Doh! You are right. BTW Gtk2 calls them tooltips as well, so forget about calling them balloons, unless for educational purposes within Tk. ! :-)

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku

        Ouh, I just forgot to post it! I I found how to write it, thanks a lot!
        Here is an example :

        use Tkx; Tkx::package_require('tooltip'); Tkx::namespace_import("::tooltip::tooltip"); my $mw = Tkx::widget->new("."); my $nameDTDlbl = $mw->new_ttk__label(-text => "The following entry wid +get got a tooltip :"); $nameDTDlbl->g_grid( -column => 0, -row => 0, -sticky => "we", -pady=> +5); my $nameDTDcase= $mw->new_ttk__entry(-width => 35,); $nameDTDcase->g_grid( -column => 0, -row => 1, -sticky => "w", -padx=> +10, -pady => "0 3"); Tkx::tooltip($nameDTDcase, "Example : \"tei_corpus.dtd\""); Tkx::MainLoop();

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://824504]
Approved by biohisham
Front-paged by biohisham
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-07-27 07:06 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (404 votes). Check out past polls.