1labelframe(n) Tk Built-In Commands labelframe(n)
2
3
4
5______________________________________________________________________________
6
8 labelframe - Create and manipulate labelframe widgets
9
11 labelframe pathName ?options?
12
14 -borderwidth -highlightbackground -pady
15 -cursor -highlightcolor -relief
16 -font -highlightthickness -takefocus
17 -foreground -padx -text
18
19 See the options manual entry for details on the standard options.
20
22 [-background background] This option is the same as the standard back‐
23 ground option except that its value may also be specified as an empty
24 string. In this case, the widget will display no background or border,
25 and no colors will be consumed from its colormap for its background and
26 border. [-class class] Specifies a class for the window. This class
27 will be used when querying the option database for the window's other
28 options, and it will also be used later for other purposes such as
29 bindings. The class option may not be changed with the configure wid‐
30 get command. [-colormap colormap] Specifies a colormap to use for the
31 window. The value may be either new, in which case a new colormap is
32 created for the window and its children, or the name of another window
33 (which must be on the same screen and have the same visual as path‐
34 Name), in which case the new window will use the colormap from the
35 specified window. If the colormap option is not specified, the new
36 window uses the same colormap as its parent. This option may not be
37 changed with the configure widget command. [-height height] Specifies
38 the desired height for the window in any of the forms acceptable to
39 Tk_GetPixels. If this option is less than or equal to zero then the
40 window will not request any size at all. [-labelanchor labelAnchor]
41 Specifies where to place the label. A label is only displayed if the
42 -text option is not the empty string. Valid values for this option are
43 (listing them clockwise) nw, n, ne, en, e, es, se, s,sw, ws, w and wn.
44 The default value is nw. [-labelwidget labelWidget] Specifies a widget
45 to use as label. This overrides any -text option. The widget must exist
46 before being used as -labelwidget and if it is not a descendant of this
47 window, it will be raised above it in the stacking order. [-vis‐
48 ual visual] Specifies visual information for the new window in any of
49 the forms accepted by Tk_GetVisual. If this option is not specified,
50 the new window will use the same visual as its parent. The visual
51 option may not be modified with the configure widget command.
52 [-width width] Specifies the desired width for the window in any of the
53 forms acceptable to Tk_GetPixels. If this option is less than or equal
54 to zero then the window will not request any size at all.
55_________________________________________________________________
56
58 The labelframe command creates a new window (given by the pathName
59 argument) and makes it into a labelframe widget. Additional options,
60 described above, may be specified on the command line or in the option
61 database to configure aspects of the labelframe such as its background
62 color and relief. The labelframe command returns the path name of the
63 new window.
64
65 A labelframe is a simple widget. Its primary purpose is to act as a
66 spacer or container for complex window layouts. It has the features of
67 a frame plus the ability to display a label.
68
70 The labelframe command creates a new Tcl command whose name is the same
71 as the path name of the labelframe's window. This command may be used
72 to invoke various operations on the widget. It has the following gen‐
73 eral form:
74 pathName option ?arg arg ...?
75 PathName is the name of the command, which is the same as the label‐
76 frame widget's path name. Option and the args determine the exact
77 behavior of the command. The following commands are possible for frame
78 widgets:
79
80 pathName cget option
81 Returns the current value of the configuration option given by
82 option. Option may have any of the values accepted by the
83 labelframe command.
84
85 pathName configure ?option? ?value option value ...?
86 Query or modify the configuration options of the widget. If no
87 option is specified, returns a list describing all of the avail‐
88 able options for pathName (see Tk_ConfigureInfo for information
89 on the format of this list). If option is specified with no
90 value, then the command returns a list describing the one named
91 option (this list will be identical to the corresponding sublist
92 of the value returned if no option is specified). If one or
93 more option-value pairs are specified, then the command modifies
94 the given widget option(s) to have the given value(s); in this
95 case the command returns an empty string. Option may have any
96 of the values accepted by the labelframe command.
97
99 When a new labelframe is created, it has no default event bindings:
100 labelframes are not intended to be interactive.
101
103 This shows how to build part of a GUI for a hamburger vendor. The
104 labelframe widgets are used to organize the available choices by the
105 kinds of things that the choices are being made over.
106
107 grid [labelframe .burger -text "Burger"] \
108 [labelframe .bun -text "Bun"] -sticky news
109 grid [labelframe .cheese -text "Cheese Option"] \
110 [labelframe .pickle -text "Pickle Option"] -sticky news
111 foreach {type name val} {
112 burger Beef beef
113 burger Lamb lamb
114 burger Vegetarian beans
115
116 bun Plain white
117 bun Sesame seeds
118 bun Wholemeal brown
119
120 cheese None none
121 cheese Cheddar cheddar
122 cheese Edam edam
123 cheese Brie brie
124 cheese Gruy\u00e8re gruyere
125 cheese "Monterey Jack" jack
126
127 pickle None none
128 pickle Gherkins gherkins
129 pickle Onions onion
130 pickle Chili chili
131 } {
132 set w [radiobutton .$type.$val -text $name -anchor w \
133 -variable $type -value $val]
134 pack $w -side top -fill x
135 }
136 set burger beef
137 set bun white
138 set cheese none
139 set pickle none
140
142 frame(n), label(n), ttk::labelframe(n)
143
145 labelframe, widget
146
147
148
149Tk 8.4 labelframe(n)