#!/bin/sh
# execute with with wish \
exec wish "$0" "$@"

wm title . "window1"

frame .top -borderwidth 5
pack .top -side top -fill both
entry .top.entry -text butt
pack .top.entry -side left -expand yes -fill x

frame .bottom
pack .bottom -side bottom -fill both

frame .bottom.left -borderwidth 5
pack .bottom.left -side left -fill both
button .bottom.left.button1 -text button1 -command {
    .top.entry delete 0 end
    .top.entry insert 0 "button 1"
}
button .bottom.left.button2 -text button2 -command {
    .top.entry delete 0 end
    .top.entry insert 0 "button 2"
}
pack .bottom.left.button1 -side top -expand no
pack .bottom.left.button2 -side top -expand no

frame .bottom.right -borderwidth 5
pack .bottom.right -side right -fill both
radiobutton .bottom.right.radio1 -text "radiobutton1" -relief flat -variable xradio -value 1 -command {
    .top.entry delete 0 end
    .top.entry insert 0 "radio:1"
}
radiobutton .bottom.right.radio2 -text "radiobutton2" -relief flat -variable xradio -value 2 -command {
    .top.entry delete 0 end
    .top.entry insert 0 "radio:2"
}
radiobutton .bottom.right.radio3 -text "radiobutton3" -relief flat -variable xradio -value 3 -command {
    .top.entry delete 0 end
    .top.entry insert 0 "radio:3"
}
checkbutton .bottom.right.check1 -text "checkbutton1" -relief flat -variable check -command {
    .top.entry delete 0 end
    if { $check } { .top.entry insert 0 "checkbutton:on"
    } else { .top.entry insert 0 "checkbutton:off" }
}

pack .bottom.right.radio1 -side top -fill both -expand yes
pack .bottom.right.radio2 -side top -fill both -expand yes
pack .bottom.right.radio3 -side top -fill both -expand yes
pack .bottom.right.check1 -side top -fill both -expand yes

bind . <Control-c> {destroy .}

focus .
