michelle wrote:

> What I am trying to do is add cascading menus to a Tk menu widget like:
> 
> File
> New...
> ---> Router
> ---> Firewall
> Open
> ----
> Exit

Just add the submenu with the "Router" and "Firewall" entries to the
filemenu in the same way you added the submenu with the "New", "Open", and
"Exit" entries to the menu bar:

> mainWindow = Tk()
> mainWindow.title("myApp")
> 
> # create a menu
> menubar = Menu(mainWindow)
> mainWindow.config(menu=menubar)
> 
> filemenu = Menu(menubar)
> menubar.add_cascade(label="File", menu=filemenu)

new_menu = Menu(filemenu)
new_menu.add_command(label="Router")
new_menu.add_command(label="Firewall")
filemenu.add_cascade(label="New...", menu=new_menu)

> filemenu.add_command(label="Open...", command = openFileDialog)
> filemenu.add_separator()
> filemenu.add_command(label="Exit", command = mainWindow.destroy)

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to