Label

A line (or block) of static text, an image, or both. TLabel is the themed version (preferred); Label is the classic one.

Example

const l = app.TLabel({ text: 'Ready.', anchor: 'w' });
l.pack.configure({ fill: 'x', padx: 12, pady: 6 });
l.text = 'Done.'; // update any time

Options

Option Type Description
text string The label text.
textVariable StringVar Bind the text to a variable.
image Photo Show an image (with or instead of text).
compound string Text / image placement.
anchor string Alignment within the label: 'w', 'center', 'e', …
justify string Multi-line alignment: 'left', 'center', 'right'.
wrapLength number Wrap text at this width (pixels).
font string Text font.
width number Width in characters.
style string A ttk style name (TLabel only).

The classic Label also takes background / foreground / relief.

Methods

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

See also