Label
A line (or block) of static themed text, an image, or both.
Live preview
Try the Theme switcher in the toolbar — this preview restyles live:
Live preview. In the Player's built-in docs viewer (
scriptweaver --help), this rendersLabelas a live, theme-aware widget you can interact with.
Example
const l = app.Label({ 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 raw Tk label (via __native_tcl) 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
- Text — editable multi-line text
- Variables & reactivity