in reply to Re: perl/Tk font question
in thread perl/Tk font question

I'm surprised that nobody ever wanted to make a word or phrase stand out in a text string. I do it all the time in html with the CGI strong or font functions(or css) but I guess that there is no easy way to do this in Tk. Thanks for the replies.

Replies are listed 'Best First'.
Re^3: perl/Tk font question
by Tanktalus (Canon) on May 01, 2005 at 20:36 UTC

    I always got the impressoin that this type of thing was done pretty much as above - you create separate graphical elements to encapsulate each change in font. This is likely closely linked to how tags (whether HTML or proprietary or other) work as well: you begin a block, and then end it, and each block gets to be its own graphical element.

Re^3: perl/Tk font question
by spurperl (Priest) on May 02, 2005 at 05:07 UTC
    It certainly can be done, and the complexity depends on what you call easy :-)

    Using the standard label/button widgets, it can't be done because those accept simple text.

    However, you can create widgets of your own in Tk, and you can subclass a Button/whatever if you want.

    Then you can implement whichever display/graphic you want, really. You can use Rich Text capabilities in there, etc.

    A label is trivial - a region with text drawn on it. Button is now much harder - the same region, just bounded in a way that makes it feel 3D and responds to mouse clicks.