Message

A classic widget that displays a block of read-only text, wrapping it automatically to keep a roughly constant width-to-height ratio. It's a simple way to show a paragraph without managing line breaks yourself.

Message is classic-only (there is no themed equivalent). For a themed multi-line label, use TLabel with a wrapLength.

Example

const m = app.Message({
  text: 'ScriptWeaver lets you build native desktop apps in plain JavaScript — '
    + 'no web browser, no heavy runtime.',
  width: 240, // wrap at 240px
});
m.pack.configure({ fill: 'x', padx: 12, pady: 12 });

Options

Option Type Description
text string The text to display.
textVariable StringVar Bind the text to a variable.
width number Wrap width in pixels. Overrides aspect.
aspect number Target width/height ratio ×100 (default 150) when width is unset.
justify string Line alignment: 'left', 'center', 'right'.
anchor string Where the text sits in the widget: 'w', 'center', 'e', …
font string Text font.
background / foreground string Background and text colours.
relief string Border style: 'flat', 'raised', 'sunken', …

Methods

Message has no commands of its own; use the inherited widget methods and set options as properties (m.text = …). See Widget basics.

See also