I really cannot fathom how to simply make a ttk::button's label center
jusitfied. I have tried looking at ttk::style man page and determined
that there is a Button.label element which does have a -justify
option, how on earth do I set it?
Any ideas greatfully received
kind regards
Julian H J Loaring
forgot to say that the button labels have two lines
eg .b configure -text "first line\nsecond line"
by default ttk left aligns the label which (to me) looks ugly
I think that you need to create a new style:
ttk::style configure My.TButton -justify center
ttk::button .b -style My.TButton -text "first line\nsecond line"
I think one of the best tutorials about ttk is here:
http://www.tkdocs.com/tutorial/
Chapter 15.
George
Many thanks for Georgios, that works.
Alas I am still mystified as to how setting -justify on the style gets
propogated down to configure the Button.label element! Even after
reading the tutorial :-)
kind regards
Julian
When you change an option on a style, this option changes in all
elements that support this option, skipping elements that do not support
the option.
So, when you discovered that the label element has a -justify (or a
-anchor) option, the way to change it is through the style command.
So, if you change the TButton style, it will affect all buttons (since
the TButton is the default button style). A better way to do it, is
through creating a new style. Naming the new style "Anything".TButton,
means "inherit" everything from TButton, so My.TButton has all the
properties from TButton, but with different -justify option for all
elements that support it.
George
And then all became clear. Thank you so much for your time and
consideration Georgios.
kind regards
Julian