Toplevel mix with Widget

class child {
      inherit itk::Widget  
      public variable child_a
      constructor { args }  {
       itk_option add hull.width hull.height
       $itk_component(hull) configure -width 1050 -height 768 
       wm minsize [winfo toplevel $itk_component(hull)] 1050 768
       pack propagate $itk_interior 0
      
       itk_component add menu {
  menu $itk_interior.menu \
      -tearoff 0 \
      -borderwidth 1
  }
      
       [winfo toplevel $itk_component(hull)] configure \
      -menu $itk_component(menu)
      
       itk_component add sessionmenu {
   menu $itk_interior.menu.session \
       -tearoff 0
  }
      
        $itk_component(menu) add cascade \
      -label "Session" \
      -menu $itk_component(sessionmenu)
      
       itk_component add toolbar_frame {
         frame $itk_interior.tbf \
      -bd 1 \
      -relief solid
  }      
 
       itk_component add label {
     label $itk_interior.tbf.label \
         -text "Images" \
         -font 12 \
         -anchor w
        } {
     usual
     ignore -font
  }
      
       grid $itk_component(toolbar_frame) -row 0 -column 1 -sticky nswe
       pack $itk_component(label) -side left -padx 5 -pady 5 -fill both -expand 1
       eval itk_initialize $args
      }
}


child .aa
pack .aa

posted @ 2011-08-05 14:39  greencolor  阅读(98)  评论(0编辑  收藏  举报