|
Toolbar
The toolbar iwidget displays a collection of widgets arranged either in a row or a column, depending on the value of the orient option. In addition, the toolbar supports string and ballon help for each component widget. The widgets managed by the toolbar typically offer user convenience, allowing quick access to a set of commonly needed actions. Any widget may be placed on the toolbar. However, command or value oriented widgets such as buttons, radiobutons, and entries are usually the most useful kind of widgets to appear in a toolbar.
For further information, see the Toolbar
manpage
Components: hull
|
wm title . "Toolbar Example"
##=========================================================
## Create a toolbar iwidget
##=========================================================
##
iwidgets::toolbar .tb \
-balloonbackground #336699 \
-balloonforeground white \
-balloondelay1 500 \
-balloondelay2 150 \
-orient vertical \
-helpvariable helpVar
set dir [file join ${iwidgets::library} demos images]
##
## Add some buttons to the toolbar
##
foreach b {copy paste clear} {
.tb add button $b \
-balloonstr "[string totitle $b] it" \
-helpstr "this will $b the selection" \
-command "puts $b" \
-image [image create photo -file [file join $dir $b.gif]]
}
##
## Add a spacer
##
.tb add frame spacer \
-borderwidth 1 \
-width 10 \
-height 10
##
## Add one more button
##
.tb add button exit \
-balloonstr "Exit the application" \
-helpstr "this will exit the application" \
-command {exit} \
-image [image create photo -file [file join $dir exit.gif]]
.tb itemconfigure exit \
-relief groove \
-bd 4
##
## Add a status bar
##
label .stat \
-textvariable helpVar \
-relief ridge \
-background white \
-foreground #336699 \
-width 25
pack .tb .stat \
-expand 1 \
-fill both \
-pady 5
|
Download this sample code |
|