3 # This demonstration script creates a toplevel window containing
4 # several labelframe widgets.
6 if {![info exists widgetDemo
]} {
7 error "This script should be run from the \"widget\" demo."
15 wm title
$w "Labelframe Demonstration"
16 wm iconname
$w "labelframe"
21 label $w.msg
-font $font -wraplength 4i
-justify left
-text "Labelframes are\
22 used to group related widgets together. The label may be either \
23 plain text or another widget."
26 ## See Code / Dismiss buttons
27 set btns
[addSeeDismiss
$w.buttons
$w]
28 pack $btns -side bottom
-fill x
33 pack $w.f
-side bottom
-fill both
-expand 1
36 # A group of radiobuttons in a labelframe
38 labelframe $w.f
-text "Value" -padx 2 -pady 2
39 grid $w.f
-row 0 -column 0 -pady 2m
-padx 2m
41 foreach value
{1 2 3 4} {
42 radiobutton $w.f.b
$value -text "This is value $value" \
43 -variable lfdummy
-value $value
44 pack $w.f.b
$value -side top
-fill x
-pady 2
48 # Using a label window to control a group of options.
50 proc lfEnableButtons
{w
} {
51 foreach child
[winfo children
$w] {
52 if {$child == "$w.cb"} continue
54 $child configure
-state normal
56 $child configure
-state disabled
61 labelframe $w.f2
-pady 2 -padx 2
62 checkbutton $w.f2.cb
-text "Use this option." -variable lfdummy2
\
63 -command "lfEnableButtons $w.f2" -padx 0
64 $w.f2 configure
-labelwidget $w.f2.cb
65 grid $w.f2
-row 0 -column 1 -pady 2m
-padx 2m
68 foreach str
{Option1 Option2 Option3
} {
69 checkbutton $w.f2.b
$t -text $str
70 pack $w.f2.b
$t -side top
-fill x
-pady 2
76 grid columnconfigure
$w {0 1} -weight 1