The flatbutton widget

Commands

::tclmacbag::flatbutton pathName ?Options?

Available options:

::tclmacbag::flatbutton_Set pathName ?Options?

Available options:

Example

set home [file dirname [info script]]
set picture1 [image create photo -file [file join $home image1.gif]]
set picture2 [image create photo -file [file join $home image2.gif]]

grid [ttk::frame .f]
grid [::tclmacbag::flatbutton .f.b1 -image $picture1 \
 -command { puts "Box 1" }] -row 1 -column 1
grid [::tclmacbag::flatbutton .f.b2 -image $picture2 \
 -command { puts "Box 2" }] -row 1 -column 2
grid [::tclmacbag::flatbutton .f.b3 -image $picture1 \
 -command { puts "Box 3" } -force yes] -row 1 -column 3
grid [::tclmacbag::flatbutton .f.b4 -image $picture2 \
 -command { puts "Box 4" } -state disabled -force yes] -row 1 -column 4

::tclmacbag::flatbutton_Set .f.b2 -state disabled

Further information

Only images are supported with this button. However, an effective solution for those needing composite buttons is to use the grid geometry system and position a Tile/Ttk label directly underneath the button.

You might like to use Tcllib's tooltip package to provide your users with additional textual hints if your button images might be misunderstood.

Do not attempt to change settings in this widget by using $w configure.

As is standard, ::tclmacbag::flatbutton returns with value of pathName, for ease of use with geometry managers like grid and pack.