ttk styles

Peter peter.milliken at gmail.com
Sun Mar 13 23:08:29 EDT 2011


Hi I'm struggling to get a good understanding of styles as used in
ttk. I have read the tutorial section on using styles but haven't been
able to solve this problem.

I am attempting to create a Checkbutton with the indicatoron=false
option. Using ttk the documentation is clear that you have to create a
custom style to achieve this behaviour. But the only "example" I have
been able to find on the Internet searches is written in Tcl i.e. here
is what I have found (quoted directly):

Here’s how you set it up: To achieve the effect of -indicatoron false,
create a new layout that doesn’t have an indicator:

style layout Toolbar.TCheckbutton {
      Toolbutton.border -children {
           Toolbutton.padding -children {
                 Toolbutton.label
           }
      }
}

Then use style map and style default to control the border appearance:

style default Toolbar.TCheckbutton \
     -relief flat
style map Toolbar.TCheckbutton -relief {
      disabled flat
      selected sunken
      pressed sunken
      active raised

Hopefully somebody else in this group has "done" this and can post
their "solution"?

Thanks
Peter



More information about the Python-list mailing list