in reply to Perl Tk Spaces in Text of Labels

As a general rule, if you use a fixed-width font for labels and other widgets, it will be easier to get things to line up nicely. If you must use proportional fonts, you either have to accept some limitations on alignment, or else you have to do a lot more work to enforce the alignment you want.

Update: What I mean is: Perl/Tk does not really truncate or reduce consecutive spaces in the text of a label widget, but when using a proportional font, the spaces are narrower than most characters, whereas with a fixed-width font, such as "courier", every space counts for the same width as any other character, so labels with text strings like the following will come out the same width when displayed with a courier font:

"one two" "three four"

Replies are listed 'Best First'.
Re^2: Perl Tk Spaces in Text of Labels
by merrymonk (Hermit) on Jul 03, 2008 at 07:10 UTC
    As ever, many thanks for the replies. I will try and sort it using the ideas.
    I can see that if this all fails I will have to send an example.
      Update:
      I have now come up with a solution that others may like to hear.
      The situation is that I want a row of headings above a vertically scrolling pane.
      The pane had frame and the frame a grid of ‘cells’ that corresponded to the heading row.
      I am using the grid packing method.
      I did want to use proportion fonts since these look better that fixed width fonts.
      I created an gif file of the headings by:
      1. getting a screen dump of the gui without the headings;
      2. using a graphics application to view the screen shot;
      3. lay out the headings as text so that these were positioned correctly:
      4. save just the headings with the background of the GUI as a gif file;
      5. used the gif file on the label.
      Perhaps not perfect but certainly acceptable.
        The one drawback to using a graphic as a header, is what happens if someone wants to resize the whole window. With a graphic label, you will be forced into a certain window geometry. But if it works for you, great.

        I'm not really a human, but I play one on earth CandyGram for Mongo