* Alexandru <
[email protected]>
| Andreas Leitgeb schrieb am Montag, 14. August 2023 um 13:27:17 UTC+2:
| > Alexandru <
[email protected]> wrote:
| > > Instead the content should be left aligned (-sticky w).
| > Maybe you're looking for button's " -anchor w " ?
| > (for grid, you still need -sticky nsew or ew)
| Yes! That's it. Here is a demo below.
| All 3 buttons have same lenght and the text is left aligned.
| ttk::button .b -style Toolbutton -text "Foo"
| ttk::button .e -style Toolbutton -text "Foo Foo"
| ttk::button .l -style Toolbutton -text "Foo Foo Foo"
| grid .b -sticky ew
| grid .e -sticky ew
| grid .l -sticky ew
| grid anchor .b w
| grid anchor .e w
| grid anchor .l w
I *think* that 'grid anchor' does something different than Andreas
suggested.
Andreas suggested to use the -anchor option of the ttk TButton style (he
posted for 'button', but since you're using a 'ttk::button', you need to
use the option with the same name of the ttk::style):
# only specific buttons should get anchor w, so create a separate style for it:
ttk::style configure W.TButton -anchor w
# use that style with the specific buttons
ttk::button .b -style Toolbutton -text "Foo" -style W.TButton
ttk::button .e -style Toolbutton -text "Foo Foo" -style W.TButton
ttk::button .l -style Toolbutton -text "Foo Foo Foo" -style W.TButton
grid .b -sticky ew
grid .e -sticky ew
grid .l -sticky ew
Compare the L&F of that to your code: on my system (Linux, tk8.6) with
your code the relief of the buttons is missing.
HTH
R'
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)