python tkinter menu

 python3 in, Tkinter written menu interface Case

Tkinter * Import from 

Top = Tk () 
top.wm_title ( "Menu") 
top.geometry ( "400x300 + 300 + 100") 

# Create a menu item, similar to the navigation bar 
MenuBar = Menu (Top) 

# Create a menu item 
fmenu1 = menu (Top) 
for item in [ 'New', 'open', 'save', 'save as']: 
    # If a menu item when the menu top-level menu, then it is added is a menu item pull-down menu. 
    fmenu1.add_command (Item label =) 

fmenu2 = Menu (Top) 
for in Item [ 'Copy', 'Paste', 'Cut']: 
    fmenu2.add_command (Item label =) 

fmenu3 = Menu (Top) 
for in Item [ 'default view', 'new view']: 
    fmenu3.add_command (Item label =) 

fmenu4 = Menu (Top) 
for in Item [ "copyright information", "other"]: 
    fmenu4.

# Of course, it is essential to label attribute specifies the name of the menu item 
menubar.add_cascade (label = "edit", the MENU = fmenu2) 
menubar.add_cascade (label = "view", the MENU = fmenu3) 
MenuBar. add_cascade (label = "on", menu = fmenu4) 

# last menu can be specified in the properties window which we use it as a top menu 
Top [ 'menu'] = MenuBar 
top.mainloop ()

  

Guess you like

Origin www.cnblogs.com/wqzn/p/11084075.html