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