Widget(toplevel) menu

class menuthree {
 inherit itk::Widget
 constructor { args } {
#  wm protocol [winfo toplevel $itk_component(hull)]  WM_DELETE_WINDOW [code $this shutdown]

  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 projectmenu {
      menu $itk_interior.menu.project \
   -tearoff 0
  }
  
  $itk_component(menu) add cascade \
      -label "Project" \
      -menu $itk_component(projectmenu)   
 }
}
menuthree .c
pack .c

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