class command body

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
 public method changtext
 
 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 "$itk_component(hull) changtext ccc"
 }
 pack $itk_component(linetwo)
 pack $itk_component(buttontwo)
 }
}

body cc::changtext { args } {
 .ck.a configure -text $args
 .c.d configure -text $args  
}

cc .c
pack .c

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