|
Extbutton
The extbutton iwidget extends the behavior of the Tk button by allowing a bitmap or image to coexist with text. The image will be able to be positioned anywhere relative to the text of the button (n,e,w,s, etc).
For further information, see the Extbutton
manpage
Components: frame hull image label ring
|
wm title . "Extbutton Example"
##
## NOTE: This is similar to the toolbar example,
## but notice we are using extbuttons here
## instead of the Tk buttons
##
##
## Create a toolbar iwidget for demo purposes
##
iwidgets::toolbar .tb \
-balloonbackground #336699 \
-balloonforeground white \
-balloondelay1 500 \
-balloondelay2 150 \
-helpvariable helpVar
set dir [file join ${iwidgets::library} demos images]
##=========================================================
## Add some extbutton iwidgets to the toolbar
##=========================================================
##
foreach b {copy paste clear} {
.tb add iwidgets::extbutton $b \
-balloonstr "[string totitle $b] it" \
-helpstr "this will $b the selection" \
-text "$b" \
-imagepos n \
-command "puts $b" \
-relief groove \
-image [image create photo -file [file join $dir $b.gif]]
}
##
## Add a status bar
##
label .stat \
-textvariable helpVar \
-relief ridge \
-background white \
-foreground #336699 \
-width 25
pack .tb .stat \
-expand 1 \
-fill both \
-pady 10
|
Download this sample code |
|