[ABU] 23-07-2020
ASome variations of the classic checkbutton widget.
&|[Image: Checkbuttons]|[Image: CheckbuttonsAlt]|&
The following code is based on a set of small PNG images. Here is a link to a https://drive.google.com/file/d/1NVUgWVH3CoeLWZX_EAn_vwg4RlevTYcq/view?usp=sharing%|%zip containing two basic images and other variations
***How to use***
Define a new ttk style ...
======
# ---------------------------------------
# Creating a Checkbutton variant ....
# ---------------------------------------
set imageDir .....
image create photo toggle.off -file [file join $imageDir toggle20off.png]
image create photo toggle.green -file [file join $imageDir toggle20green.png]
# A new image element ; the 'active' image is green
ttk::style element create Checkbutton.Toggle.Green image {
toggle.off selected toggle.green
}
# define a new style using the Green checkbutton
ttk::style layout TCheckbutton.Toggle.Green {
Checkbutton.padding -sticky nswe -children {
Checkbutton.Toggle.Green -side left -sticky {}
Checkbutton.label -sticky nswe
}
}
======
Usage:
====== ttk::checkbutton $w.c2hkbox1 -text " some text" -style TCheckbutton.Toggle.Green
======