From: iu2 on
Hi all,

How can I create a ttk::checkbutton (or an old checkbutton) with the
text lable placed on top of it instead of to the right?

Thank you very much
From: Donal K. Fellows on
On 21 Oct, 12:19, iu2 <isra...(a)elbit.co.il> wrote:
> How can I create a ttk::checkbutton (or an old checkbutton) with the
> text lable placed on top of it instead of to the right?

Works for me on OSX if I use the '-compound bottom' option.

Donal.
From: Emiliano on
On 21 oct, 08:19, iu2 <isra...(a)elbit.co.il> wrote:
> Hi all,
>
> How can I create a ttk::checkbutton (or an old checkbutton) with the
> text lable placed on top of it instead of to the right?
>
> Thank you very much

You need to create a new style:

------------------------------------------
package require Tk

set i 0
# for each theme, crete a new style with the corresponding layout
foreach theme [ttk::themes] {
ttk::style theme settings $theme {
ttk::style layout Topl.TCheckbutton {
Checkbutton.padding -sticky nswe -children {Checkbutton.indicator\
-side bottom -sticky {} Checkbutton.focus -side left -sticky w\
-children {Checkbutton.label -sticky nswe}}
}
}

# after 2 sec, change the theme
after [expr {2000*$i}] [list ttk::style theme use $theme]
incr i

}

# create the checkbutton with the new style
ttk::checkbutton .cb -text "This label goes on top" -style
Topl.TCheckbutton
pack .cb -padx 10 -pady 10

------------------------------------------

Regards
Emiliano
 | 
Pages: 1
Prev: Tree control
Next: expect and stdout