You are here

radiobutton 사용법에 관한 질문입니다.

radiobutton 을 사용하였는데요,
예를 들어
radiobutton $w1.f1.rb1 -text "MET1" -variable m1_r -value M1
radiobutton $w1.f1.rb2 -text "MET2" -variable m2_r -value M2
radiobutton $w1.f1.rb3 -text "MET3" -variable m3_r -value M3
radiobutton $w1.f1.rb4 -text "MET4" -variable m4_r -value M4

이와 같이 4가지를 radiobutton 으로 만들었고 GUI 도 잘 나왔습니다.
default 선택 값은 MET1 입니다.
그런데, MET2 를 선택해도 MET1 이 계속 선택 되있습니다.
즉 Multi 로 선택이 되네요.

왜 그러는지 아시는 분 도와 주세요

아래는 전체 내용입니다.

proc metalSlot { } {
  set w .top
  catch {destory $w}
  toplevel $w
  wm title $w "MetalSlot"
  wm iconname $w "title"
  wm geometry $w +200+200

  set w1 $w.f1
  frame $w1
  pack $w1 -side top -fill both -expand 1
 
  #

  labelframe $w1.f1 -pady 2 -padx 2
  checkbutton $w1.f1.cb -text "130n" -variable m1 -command "checkEnable $w1.f1 m1" -padx 0
  $w1.f1 configure -labelwidget $w1.f1.cb
  grid $w1.f1 -row 0 -column 0 -pady 2m -padx 2m
  radiobutton $w1.f1.rb1 -text "MET1"  -variable m1_r -value M1
  radiobutton $w1.f1.rb2 -text "MET2"  -variable m2_r -value M2
  radiobutton $w1.f1.rb3 -text "MET3"  -variable m3_r -value M3
  radiobutton $w1.f1.rb4 -text "MET4"  -variable m4_r -value M4
  pack $w1.f1.rb1 -side left -fill x -pady 2
  pack $w1.f1.rb2 -side left -fill x -pady 2
  pack $w1.f1.rb3 -side left -fill x -pady 2
  pack $w1.f1.rb4 -side left -fill x -pady 2
  $w1.f1.cb select
  $w1.f1.rb3 select
  checkEnable $w1.f1 m1
 #
  labelframe $w1.f2 -pady 2 -padx 2
  checkbutton $w1.f2.cb -text "90n" -variable m2 -command "checkEnable $w1.f2 m2" -padx 0
  $w1.f2 configure -labelwidget $w1.f2.cb
  grid $w1.f2 -row 0 -column 1 -pady 2m -padx 2m
  radiobutton $w1.f2.rb1 -text "MET1" -variable m1_s -value M1
  radiobutton $w1.f2.rb2 -text "MET2" -variable m2_s -value M2
  radiobutton $w1.f2.rb3 -text "MET3" -variable m3_s -value M3
  radiobutton $w1.f2.rb4 -text "MET4" -variable m4_s -value M4
  pack $w1.f2.rb1 -side left -fill x -pady 2
  pack $w1.f2.rb2 -side left -fill x -pady 2
  pack $w1.f2.rb3 -side left -fill x -pady 2
  pack $w1.f2.rb4 -side left -fill x -pady 2
  $w1.f2.cb select
  $w1.f2.rb1 select
  checkEnable $w1.f2 m2
 #

  button $w.b1 -relief flat -bg blue -fg yellow -borderwidth 5 -text "slice" -command "catch {dbLayerTile MT1}" -width 70
  button $w.b2 -relief flat -bg gray70 -borderwidth 5 -text "run" -command "catch metalSlot_main" -width 70
  button $w.b3 -relief flat -bg gray40 -borderwidth 5 -text "exit" -command "destroy $w" -width 70
  pack $w.b1 $w.b2 $w.b3 -side top -expand 1

}
proc checkEnable {w arg} {
   set value [getButtonValue $arg]
   foreach child [winfo children $w] {
      if {$child == "$w.cb"} continue
      if {$value} {
         $child configure -state normal
      } else {
         $child configure -state disabled
      }
   }
}
proc getButtonValue {varname} {
  upvar #0 $varname var
  return $var
}
metalSlot