Widget

class child {
      inherit itk::Widget  
      public variable child_a
      constructor { args }  {

       itk_component add menu_frame {
        frame $itk_interior.mf \
            -bd 1 \
            -relief solid
        } 
       itk_component add label {
  label $itk_interior.mf.l1 \
       -text "Name"
  }
      
      
       itk_component add toolbar_frame {
         frame $itk_interior.tbf \
      -bd 1 \
      -relief solid
  }      
 
       itk_component add label2 {
     label $itk_interior.tbf.label \
         -text "Images" \
         -font 12 \
         -anchor w
        } {
     usual
     ignore -font
  }
      
       grid $itk_component(menu_frame) -row 0 -column 0 -sticky nswe
       pack $itk_component(label)      
 
       grid $itk_component(toolbar_frame) -row 1 -column 0 -sticky nswe
       pack $itk_component(label2) -side left -padx 5 -pady 5 -fill both -expand 1
       eval itk_initialize $args
      }
}


child .aa
pack .aa

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