Label(3) User Contributed Perl Documentation Label(3)

Tk::Label - Create and manipulate Label widgets

$label = $parent->Label(?options?);

-activebackground -activeforeground -anchor -background -bitmap -borderwidth -compound -cursor -disabledforeground -font -foreground -highlightbackground -highlightcolor -highlightthickness -image -justify -padx -pady -relief -takefocus -text -textvariable -underline -wraplength

See Tk::options for details of the standard options.

Specifies a desired height for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option isn't specified, the label's desired height is computed from the size of the image or bitmap or text being displayed in it.
Specifies one of three states for the label: normal, active, or disabled. In normal state the label is displayed using the foreground and background options. In active state the label is displayed using the activeForeground and activeBackground options. In the disabled state the disabledForeground and background options determine how the button is displayed.
Specifies a desired width for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option isn't specified, the label's desired width is computed from the size of the image or bitmap or text being displayed in it.

The Label method creates a new window (given by the $widget argument) and makes it into a label widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the label such as its colors, font, text, and initial relief. The label command returns its $widget argument. At the time this command is invoked, there must not exist a window named $widget, but $widget's parent must exist.

A label is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the wrapLength option) and one of the characters may optionally be underlined using the underline option. The label can be manipulated in a few simple ways, such as changing its relief or text, using the commands described below.

The Label method creates a widget object. This object supports the configure and cget methods described in Tk::options which can be used to enquire and modify the options described above. The widget also inherits all the methods provided by the generic Tk::Widget class.

When a new label is created, it has no default event bindings: labels are not intended to be interactive.

label, widget

2023-07-25 perl v5.38.0