|
Labeledwidget
The labeledwidget iwidget is the most primitive mega-widget in the set, providing label support in the other classes. The class contains a label, a margin, and a child site which can be filled with other widgets. The options provide the ability to position the label around the child site, modify the font, adjust the margin distance, and enable/disable label display.
For further information, see the Labeledwidget
manpage
Components: hull label
|
wm title . "Labeledwidget Example"
##
## Generate some colors
##
array set c {1 red 2 green 3 blue 4 black}
##=========================================================
## Create some labeledwidgets
##=========================================================
##
foreach {lw p} {1 n 2 s 3 e 4 w} {
iwidgets::labeledwidget .lw$lw \
-labeltext "Canvas $lw"
set cs [.lw$lw childsite]
##
## create an example widget
##
canvas $cs.c \
-relief raised \
-width 100 \
-height 100 \
-background $c($lw)
grid config $cs.c
grid config .lw$lw \
-column [expr {($lw-1)/2}]\
-row [expr {($lw-1)%2}]\
-sticky news \
-padx 20 \
-pady 20
##
## Do a post configure
##
.lw$lw configure \
-labelpos $p \
-labelmargin 10
}
|
Download this sample code |
|