from Tkinter import *
class TestMenu:
def __init__(self, master):
self.master = master
self.menubar = Menu(self.master)
self.casmenu = Menu(self.menubar)
self.casmenu.choices = Menu(self.casmenu)
self.casmenu.choices.wierdones = Menu(self.casmenu.choices)
self.casmenu.choices.wierdones.add_command(label='A')
self.casmenu.choices.wierdones.add_command(label='B')
self.casmenu.choices.wierdones.add_command(label='C')
self.casmenu.choices.wierdones.add_command(label='D')
self.casmenu.choices.add_command(label='A')
self.casmenu.choices.add_command(label='B')
self.casmenu.choices.add_command(label='C')
self.casmenu.choices.add_command(label='D')
self.casmenu.choices.add_command(label='E')
self.casmenu.choices.add_command(label='F')
self.casmenu.choices.add_cascade(label='G',
menu=self.casmenu.choices.wierdones)
self.casmenu.add_cascade(label='Scripts',
menu=self.casmenu.choices)
self.unused = Menu(self.menubar)
self.menubar.add_cascade(label="Cascade Menu", menu=self.casmenu)
self.top = Toplevel(menu=self.menubar, width=500, relief=RAISED,
borderwidth=2)
def main():
root = Tk()
root.withdraw()
app = TestMenu(root)
root.mainloop()
if __name__ == '__main__':
main()
|