class command proc

proc changtext { args } {
   .ck.a configure -text $args
   .c.d configure -text $args  
}

class cddd {
 inherit itk::Widget
 constructor { args } {
        itk_component add lineone {
  label $itk_component(hull).a \
             -text "getv"
        }
 pack $itk_component(lineone)
  }
}
cddd .ck
pack .ck

class cc {
 inherit itk::Widget   
 constructor {args} {
 itk_component add linetwo {
       label $itk_component(hull).d \
                  -text "bbb"    
 }
 itk_component add buttontwo {
       button $itk_component(hull).b \
            -text "est" \
            -command "changtext ccc"
 }
 pack $itk_component(linetwo)
 pack $itk_component(buttontwo)
 }
}

cc .c
pack .c

原文地址:https://www.cnblogs.com/greencolor/p/2132157.html