Richard Suchenwirth 2008-04-24 - Here is a little non-modal dialog to change a global variable which contains a list or dict like

   foo 1 bar 0 grill 1

The odd elements are taken as checkbutton labels, the even ones as the corresponding (Boolean) values. You can toggle the value of a label by clicking on it, as usual. With the "Apply" button, the variable is set to the current values.

WikiDbImage checkvar.jpg

 proc checkvar _var {
    upvar #0 $_var var
    set t [toplevel .[clock clicks]]
    wm title $t $_var
    foreach {name bool} $var {
        pack [checkbutton $t.c$name -text $name -variable g(c$name)] -anchor w
        set ::g(c$name) [expr !!$bool]
    pack [button $t.ok -text Apply -command "checkvar_set $_var $t"] -fill x
    pack [ entry $t.disp -textvar $_var -state readonly ]
 proc checkvar_set {_var w} {
    upvar #0 $_var var
    set res {}
    foreach i [winfo children $w] {
        if {[winfo class $i] ne "Checkbutton"} continue
        set name [$i cget -text]
        lappend res $name $::g(c$name)
    set var $res

#-- Testing example:

 set ::thisvar {foo 1 bar 0 grill 1}
 checkvar thisvar

 catch {wm withdraw .}

HJG 2008-12-23 added a displayfield to show the current value of thisvar.