Previous: Label widgets
Up: Widgets
Next: Entry widgets
Previous Page: Label widgets
Next Page: Entry widgets
Message widgets are similar to label widgets, since they display text, but the text may extend over several lines:
message .msg -text "When the lights turn green you may proceed with caution - when the lights are red you must stop - when the lights turn to red you should stop, unless it is dangerous to do so, and would endanger following traffic - when the lights are amber, you should prepare to stop, and when the red and amber lights are on, you may prepare to move off.If the lights remain in the same state for several minutes they are probably faulty, and assistance should be called if possible. Under these circumstances you may proceed across the junction with extreme caution." pack .msg
It is allowable to insert continuation characters
, tabs (
t) and
end of line characters (
n) within message text to provide better control
over layout, as in:
message .msg -width 400 -text "The following actions apply to traffic lights in the United Kingdom.\n When the lights turn \n \t * green \t\t proceed with caution \t * red \t\t stop if safe to do so \t * amber \t\t prepare to stop if safe to do so \t * red and amber \t prepare to move off when safe. \n If the lights remain in the same state for several minutes they are probably faulty, and assistance should be called if possible. Under these circumstances you may proceed across the junction with extreme caution." pack .msg
As with label widgets, message widgets have very largely the same set of configuration options, such as -relief sunken etc. It is useful to have explicit control over the width and height of message widgets, which would help to overcome the ragged appearance of the previous example, but this widget does not have a height option!
#Note: the value of width for this widget is # NOT given in characters.message .msg2 -width 200 text "This is a warning: Please do not lean out of the window." pack .msg2