in reply to perl/Tk font question

That is the first time I've ever heard that question asked. You might be able to pack some labels together, with no padding, and have different fonts in each one. Or you could make a custom image, and use that.

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: perl/Tk font question
by alw (Sexton) on May 01, 2005 at 20:29 UTC
    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.

      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.

      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.