wm title . "Checkbox Example" ## ## wrap in a dialog user interaction ## iwidgets::dialog .d \ -title "Checkbox Example" .d hide Help .d hide Apply .d buttonconfigure OK \ -text "Update" set cs [.d childsite] ##========================================================= ## Create a checkbox iwidget ##========================================================= ## iwidgets::checkbox $cs.cb \ -labeltext "Places Visited" \ -labelpos n pack $cs.cb \ -fill both \ -expand true ## ## set some lists ## set places [list australia england france germany spain hawaii tahiti] lappend places venezuela argentina greece china japan new_zealand mexico lappend places peru chile canada africa russia set been_there [list england france germany spain hawaii venezuela argentina] lappend been_there greece china japan mexico canada ## ## Add some checkbuttons ## ## Note that 'string totitle' is valid ## for tcl_version >= 8.1 ## foreach c [lsort $places] { $cs.cb add $c \ -text [string totitle $c] } ## ## Select some of the boxes ## foreach c $been_there { $cs.cb select $c } ## ## activate the dialog ## if {[.d activate]} { puts "Updated" }