ttk::checkbutton

ttk::checkbutton , a Tk command, creates and manipulates ttk checkbutton widgets.

See Also

checkbutton
the classic Tk checkbutton widget

Documentation

official reference

Description

Mat: To remove the indictator and have your checkbuttons look like normal buttons, use a custom style:

# 1. create a new style "MatButton" based on the default style for checkbuttons
ttk::style configure MatButton.TCheckbutton

# 2. use the same layout, that normal buttons use
ttk::style layout MatButton.TCheckbutton [ttk::style layout TButton]

# 3. our style should adjust its relief to reflect the select state
ttk::style map MatButton.TCheckbutton -relief {selected sunken !selected raised}

# and we're done.. create a new checkbutton and enjoy :)
pack [ttk::checkbutton .b -text "Check Me" -style MatButton.TCheckbutton]

Mat: Update - Just thinking about that, if you directly inherit from Button in step 1, by naming the style MatButton.TButton, you could skip step 2. I've just tried it with 8.5.8 and it works the same, though I have no idea what the preferred way of doing this is.

EG: Why not use the Toolbutton style? It works with all the standard themes and is designed for toolbar buttons.

Mat: Well, to be frank, because I didn't know that existed... which I attribute to the sparse and confusing tile documentation of course :)

Custom Font

HaO 2011-05-20: Use a custom style to use a custom font

ttk::style configure custom.TCheckbutton -font {size 20}
pack [ttk::checkbutton .b -style custom.TCheckbutton -text Big]

Tristate

AMG: Do any of the themes available on Linux/Unix support tristate? I can only get it to work using the Windows themes, but my application needs to be cross-platform.

I should note that non-Ttk checkbutton tristate works fine for me in both Windows and Linux, other than the lack of theming.

Tcl/Tk version 8.6.6.