ttk::label(n)

πŸ’… ttk::label(n) β€” the Tk Themed Widget glow-up πŸŽ€

ok so bestie, welcome to ttk::label, the themed label widget. She's in the Tk family, manual section n, and honestly? she's that girl. Let's get into it ✨


🌸 NAME 🌸

ttk::label β€” display a text string and/or image. That's it, that's the whole job, and she does it beautifully πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

ttk::label pathName ?options?

literally just give her a pathName and optionally some options and you're good to go 🫢


πŸ’œ DESCRIPTION πŸ’œ

A ttk::label widget displays a textual label and/or image β€” no cap, that's her whole moment. And here's the iconic part: the label can be linked to a Tcl variable so the displayed text updates automatically. set the variable, the label changes, you don't lift a finger. main character energy fr fr πŸ‘‘


⭐ STANDARD OPTIONS ⭐

these are the standard faves β€” same energy as every ttk widget:

  • -anchor
  • -class
  • -compound
  • -cursor
  • -font
  • -foreground
  • -image
  • -justify
  • -padding
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • -wraplength
πŸ‘€ heads up bestie: check the ttk_widget manual entry for the full deets on all these standard options. iykyk.

πŸ”₯ WIDGET-SPECIFIC OPTIONS πŸ”₯

these are the ones that are hers, and they're giving very much custom πŸ’…

  • -background (database name frameColor, database class FrameColor) β€” the widget's background color. If you don't specify it, the theme default is used. no stress, the theme has you 🌈
  • -relief (database name relief, database class Relief) β€” specifies the 3-D effect you want for the widget border. valid values are flat, groove, raised, ridge, solid, and sunken. pick your vibe πŸŽ€
  • -wraplength (database name wrapLength, database class WrapLength) β€” specifies the maximum line length (in pixels). if this option is negative or zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value. so basically: give her a number and she'll wrap for you, give her zero or negative and she's not wrapping, periodt βœ‚οΈ

🌈 WIDGET COMMAND 🌈

label widgets support the standard commands β€” cget, configure, identify element, instate, state and style. that's the squad. see ttk::widget for the details 🫢


πŸ‘‘ STYLING OPTIONS πŸ‘‘

the class name for a ttk::label is TLabel. remember that name, she answers to it πŸ’–

dynamic states: disabled, readonly.

TLabel styling options configurable with ttk::style are:

  • -background color
  • -compound compound
  • -foreground color
  • -font font
πŸ¦‹ some options are only available for specific themes β€” so if something's not showing up, it might just be your theme being picky, ngl.

see the ttk::style manual page for info on how to configure ttk styles ✨


🧚 SEE ALSO 🧚


and that's the page bestie!! πŸ’œ this whole thing is from Tk version 8.5, dated back whenever this page was minted β€” so if you're running an older Tk, that's why some things might feel a little vintage. go forth and label slay πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from