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. [-container container] The
38 value must be a boolean. If true, it means that this window will be
39 used as a container in which some other application will be embedded
40 (for example, a Tk toplevel can be embedded using the -use option).
41 The window will support the appropriate window manager protocols for
42 things like geometry requests. The window should not have any children
43 of its own in this application. This option may not be changed with
44 the configure widget command. [-height height] Specifies the desired
45 height for the window in any of the forms acceptable to Tk_GetPixels.
46 If this option is less than or equal to zero then the window will not
47 request any size at all. [-labelanchor labelAnchor] Specifies where to
48 place the label. A label is only displayed if the -text option is not
49 the empty string. Valid values for this option are (listing them
50 clockwise) nw, n, ne, en, e, es, se, s,sw, ws, w and wn. The default
51 value is nw. [-labelwidget labelWidget] Specifies a widget to use as
52 label. This overrides any -text option. The widget must exist before
53 being used as -labelwidget and if it is not a descendant of this win‐
54 dow, it will be raised above it in the stacking order. [-visual vis‐
55 ual] Specifies visual information for the new window in any of the
56 forms accepted by Tk_GetVisual. If this option is not specified, the
57 new window will use the same visual as its parent. The visual option
58 may not be modified with the configure widget command. [-width width]
59 Specifies the desired width for the window in any of the forms accept‐
60 able to Tk_GetPixels. If this option is less than or equal to zero
61 then the window will not request any size at all.
62_________________________________________________________________
63
65 The labelframe command creates a new window (given by the pathName
66 argument) and makes it into a labelframe widget. Additional options,
67 described above, may be specified on the command line or in the option
68 database to configure aspects of the labelframe such as its background
69 color and relief. The labelframe command returns the path name of the
70 new window.
71
72 A labelframe is a simple widget. Its primary purpose is to act as a
73 spacer or container for complex window layouts. It has the features of
74 a frame plus the ability to display a label.
75
77 The labelframe command creates a new Tcl command whose name is the same
78 as the path name of the labelframe's window. This command may be used
79 to invoke various operations on the widget. It has the following gen‐
80 eral form:
81 pathName option ?arg arg ...?
82 PathName is the name of the command, which is the same as the label‐
83 frame widget's path name. Option and the args determine the exact
84 behavior of the command. The following commands are possible for frame
85 widgets:
86
87 pathName cget option
88 Returns the current value of the configuration option given by
89 option. Option may have any of the values accepted by the
90 labelframe command.
91
92 pathName configure ?option? ?value option value ...?
93 Query or modify the configuration options of the widget. If no
94 option is specified, returns a list describing all of the avail‐
95 able options for pathName (see Tk_ConfigureInfo for information
96 on the format of this list). If option is specified with no
97 value, then the command returns a list describing the one named
98 option (this list will be identical to the corresponding sublist
99 of the value returned if no option is specified). If one or
100 more option-value pairs are specified, then the command modifies
101 the given widget option(s) to have the given value(s); in this
102 case the command returns an empty string. Option may have any
103 of the values accepted by the labelframe command.
104
106 When a new labelframe is created, it has no default event bindings:
107 labelframes are not intended to be interactive.
108
110 This shows how to build part of a GUI for a hamburger vendor. The
111 labelframe widgets are used to organize the available choices by the
112 kinds of things that the choices are being made over.
113
114 grid [labelframe .burger -text "Burger"] \
115 [labelframe .bun -text "Bun"] -sticky news
116 grid [labelframe .cheese -text "Cheese Option"] \
117 [labelframe .pickle -text "Pickle Option"] -sticky news
118 foreach {type name val} {
119 burger Beef beef
120 burger Lamb lamb
121 burger Vegetarian beans
122
123 bun Plain white
124 bun Sesame seeds
125 bun Wholemeal brown
126
127 cheese None none
128 cheese Cheddar cheddar
129 cheese Edam edam
130 cheese Brie brie
131 cheese Gruy\u00e8re gruyere
132 cheese "Monterey Jack" jack
133
134 pickle None none
135 pickle Gherkins gherkins
136 pickle Onions onion
137 pickle Chili chili
138 } {
139 set w [radiobutton .$type.$val -text $name -anchor w \
140 -variable $type -value $val]
141 pack $w -side top -fill x
142 }
143 set burger beef
144 set bun white
145 set cheese none
146 set pickle none
147
149 frame(n), label(n), ttk::labelframe(n)
150
152 labelframe, widget
153
154
155
156Tk 8.4 labelframe(n)