Python Tkinter Edit Menu Window

前端 未结 3 1504
太阳男子
太阳男子 2021-01-28 11:49

I\'m trying to edit Menu window. How can i edit it?

This is for Windows.

from tkinter import *

Window = Tk()

MB = Menu(Window)
Window.config(menu=MB)

         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-28 12:56

    usually you add items to menu like this - but what are looking for?

    window = Tk()
    mb = Menu(window)  
    menu_bar = Menu(mb, tearoff=0)  
    menu_bar.add_command(label="New")  
    menu_bar.add_command(label="Open")  
    menu_bar.add_command(label="Save")  
    menu_bar.add_command(label="Save as...")  
    menu_bar.add_command(label="Close")  
    
    menu_bar.add_separator()  
    
    menu_bar.add_command(label="Exit", command=window.quit)  
    
    mb.add_cascade(label="File", menu=menu_bar)
    
    top.config(menu=mb)
    

提交回复
热议问题