We help IT Professionals succeed at work.

Want to make something that looks like a link in perl/tk

jhurst
jhurst asked
on
I have a perl app that use Tk as its interface.  It works well and I am very happy with it.  I would like to add one line to it which would be a link to a web site so that I can provide more info,

I would like to have a line of text that looks like a link, that is, it should be blue and underlined and when clicked should invoke a sub so that I can popup the web browser window required.  I know how to popup the web browser so all I am looking for is how to make Prt/Tk create a line that looks like a URL and that will invoke my sub

Please provide a short example
Comment
Watch Question

This solution seems viable, but I haven't tested it:
http://www.perlmonks.org/?node_id=667638

Author

Commented:
It sure does display what I want.  But how do I make it clickable?
I tried the second set of code on my computer and it worked (meaning it printed text whenever I clicked the link).

As far as having it open a browser, this depends on the OS.  You may be able to find a module in CPAN that can open the browser.  Examples:
 * Browser::Open - http://search.cpan.org/~melo/Browser-Open-0.03/lib/Browser/Open.pm
 * HTML::Display - http://search.cpan.org/~corion/HTML-Display-0.39/lib/HTML/Display.pm

Once you have that code, all you need to do is call it instead of printing text out.