我正在寻找如何更新我的应用程序的菜单。我曾经MainFrame
创建它,但我无法更新整个菜单。
set descmenu1 {}
set FileMenuItems1 {}
lappend FileMenuItems1 [list command "f1" {} "f1" {Ctrl q} -command [list if {[tk_messageBox -message [format "%s ?" "Quit"] -type yesno] eq "yes"} {exit}]]
lappend descmenu1 "&file" all file 0 $FileMenuItems1
set EditMenu {}
lappend EditMenu1 [list command "e1" {} "e1" {Ctrl q} -command [list if {[tk_messageBox -message [format "%s ?" "Quit"] -type yesno] eq "yes"} {exit}]]
lappend descmenu1 "&Edition" all file 0 $EditMenu1
set descmenu2 {}
set FileMenuItems2 {}
lappend FileMenuItems2 [list command "f2" {} "f2" {Ctrl q} -command [list if {[tk_messageBox -message [format "%s ?" "Quit"] -type yesno] eq "yes"} {exit}]]
lappend descmenu2 "&file2" all file 0 $FileMenuItems2
set EditMenu2 {}
lappend EditMenu2 [list command "e2" {} "e2" {Ctrl q} -command [list if {[tk_messageBox -message [format "%s ?" "Quit"] -type yesno] eq "yes"} {exit}]]
lappend descmenu2 "&Edition2" all file 0 $EditMenu2
set mainframe [MainFrame .hull -menu $descmenu1]
.hull configure -menu $descmenu2
如何使用 更新我的菜单MainFrame
?实际上,显示的菜单是descmenu1
。