Version 2 of checkbutton

Updated 2002-03-26 17:37:52

http://purl.org/tcl/home/man/tcl8.4/TkCmd/checkbutton.htm


[email protected] wrote in the comp.lang.tcl newsgroup: I would like to be able to control the location of the box in checkbutton and make it appear to the right of it's text (rather than to the left -- as is the default). Is this possible?

You can approximate it with a little wrapper that places a label left of a text-less checkbutton. Quick shot:

 proc lcheckbutton {w args} {
    array set opt {-text ""}
    array set opt $args
    frame $w -bg red
    label $w.1 -text $opt(-text)
    unset opt(-text)
    eval [list checkbutton $w.2 -text {}] [array get opt]
    pack $w.2 $w.1 -side right -fill x
    set w
 } ;# RS
 #--------------------------------------- testing:
 checkbutton .1 -text Right
 lcheckbutton .2 -text Left
 eval pack [winfo children .] -anchor w

To fully emulate the checkbutton protocol, some more work is of course needed...


Tk syntax help - Arts and crafts of Tcl-Tk programming - Category Command