1label(n)                     Tk Built-In Commands                     label(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       label - Create and manipulate label widgets
9

SYNOPSIS

11       label pathName ?options?
12

STANDARD OPTIONS

14       -activebackground     -disabledforeground  -padx
15       -activeforeground     -font                -pady
16       -anchor               -foreground          -relief
17       -background           -highlightbackground -takefocus
18       -bitmap               -highlightcolor      -text
19       -borderwidth          -highlightthickness  -textvariable
20       -compound             -image               -underline
21       -cursor               -justify             -wraplength
22
23       See the options manual entry for details on the standard options.
24

WIDGET-SPECIFIC OPTIONS

26       [-height height] Specifies a desired height for the label.  If an image
27       or bitmap is being displayed in the label then the value is  in  screen
28       units  (i.e.  any of the forms acceptable to Tk_GetPixels); for text it
29       is in lines of text.  If this option  is  not  specified,  the  label's
30       desired height is computed from the size of the image or bitmap or text
31       being displayed in it.  [-state state] Specifies one  of  three  states
32       for  the label:  normal, active, or disabled.  In normal state the but‐
33       ton is displayed using  the  foreground  and  background  options.   In
34       active  state  the  label  is  displayed using the activeForeground and
35       activeBackground options.  In the disabled state the disabledForeground
36       and   background   options  determine  how  the  button  is  displayed.
37       [-width width] Specifies a desired width for the label.  If an image or
38       bitmap  is  being  displayed  in  the label then the value is in screen
39       units (i.e. any of the forms acceptable to Tk_GetPixels); for  text  it
40       is in characters.  If this option is not specified, the label's desired
41       width is computed from the size of the image or bitmap  or  text  being
42       displayed in it.
43_________________________________________________________________
44

DESCRIPTION

46       The label command creates a new window (given by the pathName argument)
47       and makes it into a label widget.  Additional options, described above,
48       may  be specified on the command line or in the option database to con‐
49       figure aspects of the label such as its colors, font, text, and initial
50       relief.   The label command returns its pathName argument.  At the time
51       this command is invoked, there must not exist a window named  pathName,
52       but pathName's parent must exist.
53
54       A  label  is  a widget that displays a textual string, bitmap or image.
55       If text is displayed, it must all be in  a  single  font,  but  it  can
56       occupy  multiple  lines  on  the  screen (if it contains newlines or if
57       wrapping occurs because of the wrapLength option) and one of the  char‐
58       acters  may  optionally  be underlined using the underline option.  The
59       label can be manipulated in a few simple ways,  such  as  changing  its
60       relief or text, using the commands described below.
61

WIDGET COMMAND

63       The  label  command  creates  a new Tcl command whose name is pathName.
64       This command may be used to invoke various operations  on  the  widget.
65       It has the following general form:
66              pathName option ?arg arg ...?
67       Option  and  the args determine the exact behavior of the command.  The
68       following commands are possible for label widgets:
69
70       pathName cget option
71              Returns the current value of the configuration option  given  by
72              option.  Option may have any of the values accepted by the label
73              command.
74
75       pathName configure ?option? ?value option value ...?
76              Query or modify the configuration options of the widget.  If  no
77              option is specified, returns a list describing all of the avail‐
78              able options for pathName (see Tk_ConfigureInfo for  information
79              on  the  format  of  this list).  If option is specified with no
80              value, then the command returns a list describing the one  named
81              option (this list will be identical to the corresponding sublist
82              of the value returned if no option is  specified).   If  one  or
83              more option-value pairs are specified, then the command modifies
84              the given widget option(s) to have the given value(s);  in  this
85              case  the  command returns an empty string.  Option may have any
86              of the values accepted by the label command.
87

BINDINGS

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

EXAMPLE

93              # Make the widgets
94              label .t -text "This widget is at the top"    -bg red
95              label .b -text "This widget is at the bottom" -bg green
96              label .l -text "Left\nHand\nSide"
97              label .r -text "Right\nHand\nSide"
98              text .mid
99              # Lay them out
100              pack .t   -side top    -fill x
101              pack .b   -side bottom -fill x
102              pack .l   -side left   -fill y
103              pack .r   -side right  -fill y
104              pack .mid -expand 1    -fill both
105

SEE ALSO

107       labelframe(n), button(n), ttk::label(n)
108

KEYWORDS

110       label, widget
111
112
113
114Tk                                    4.0                             label(n)
Impressum