| labelframe(3tk) | Tk Built-In Commands | labelframe(3tk) |
labelframe - Create and manipulate 'labelframe' labelled container widgets
labelframe pathName ?options?
-borderwidth -highlightbackground -pady -cursor -highlightcolor -relief -font -highlightthickness -takefocus -foreground -padx -text
See the options manual entry for details on the standard options.
Command-Line Name: -background Database Name: background Database Class: Background
Command-Line Name: -class Database Name: class Database Class: Class
Command-Line Name: -colormap Database Name: colormap Database Class: Colormap
Command-Line Name: -height Database Name: height Database Class: Height
Command-Line Name: -labelanchor Database Name: labelAnchor Database Class: LabelAnchor
Command-Line Name: -labelwidget Database Name: labelWidget Database Class: LabelWidget
Command-Line Name: -visual Database Name: visual Database Class: Visual
Command-Line Name: -width Database Name: width Database Class: Width
The labelframe command creates a new window (given by the pathName argument) and makes it into a labelframe widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the labelframe such as its background color and relief. The labelframe command returns the path name of the new window.
A labelframe is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. It has the features of a frame plus the ability to display a label.
The labelframe command creates a new Tcl command whose name is the same as the path name of the labelframe's window. This command may be used to invoke various operations on the widget. It has the following general form:
pathName option ?arg arg ...?
When a new labelframe is created, it has no default event bindings: labelframes are not intended to be interactive.
This shows how to build part of a GUI for a hamburger vendor. The labelframe widgets are used to organize the available choices by the kinds of things that the choices are being made over.
grid [labelframe .burger -text "Burger"] \
[labelframe .bun -text "Bun"] -sticky news
grid [labelframe .cheese -text "Cheese Option"] \
[labelframe .pickle -text "Pickle Option"] -sticky news
foreach {type name val} {
burger Beef beef
burger Lamb lamb
burger Vegetarian beans
bun Plain white
bun Sesame seeds
bun Wholemeal brown
cheese None none
cheese Cheddar cheddar
cheese Edam edam
cheese Brie brie
cheese Gruy\u00e8re gruyere
cheese "Monterey Jack" jack
pickle None none
pickle Gherkins gherkins
pickle Onions onion
pickle Chili chili
} {
set w [radiobutton .$type.$val -text $name -anchor w \
-variable $type -value $val]
pack $w -side top -fill x
}
set burger beef
set bun white
set cheese none
set pickle none
frame(3tk), label(3tk), ttk::labelframe(3tk)
labelframe, widget
| 8.4 | Tk |