Posted to tcl by patthoyts at Sat Apr 30 15:06:26 GMT 2011view pretty

package require Tk
. configure -menu [menu .menu -tearoff 1]
.menu add cascade -label Cascade -menu [menu .menu.file -tearoff 1]
.menu add cascade -label Another -menu [menu .menu.edit -tearoff 1]

.menu.file add command -label One
.menu.file add command -label Two
.menu.file add cascade -label Three -menu [menu .menu.file.three -tearoff 1]
.menu.file add separator
.menu.file add command -label Exit -command exit

.menu.file.three add command -label Four
.menu.file.three add command -label Five

foreach name {one two three four} {
    .menu.edit add command -label [string totitle $name] -command {}
}

tkwait window .