Version 0 of label wrapping

Updated 2003-02-25 05:23:43

MGS Sometimes I like to have labels that automatically wrap to the width of the window, sort of like a text widget, but without the scrolling (i.e. the whole label text is always visible). It's pretty easy to do (for basic text-only labels):

  label .l -text "A label with a long text string to test auto-wrapping"
  pack  .l -expand 1
  bind  .l <Configure> [list %W configure -wraplength %w]

For labels with compound images, it's a little bit trickier. You nhave to subtract the image width and -padx values from the label width, to get the text wraplength