package require Tk

wm title . root

menu .menubar1
menu .menubar1.child
.menubar1.child add command -label "Child 1"
.menubar1.child add command -label "Child 2"
.menubar1 add cascade -label "Child" -menu .menubar1.child

menu .menubar2
.menubar2 add cascade -label "Grandchild" -menu .menubar2.grand
menu .menubar2.grand
.menubar2.grand add command -label "Grand 1"
.menubar2.grand add command -label "Grand 2"

toplevel .t
.t configure -menu .menubar1
wm title .t Child
# Weird: without this the child appears on top of the grandchild.
update idletasks

toplevel .t.t
.t.t configure -menu .menubar2
wm title .t.t GrandDhild

