button(roottext="bye"command=root quitpack(root mainloop(frameand menubutton-based menus although these are less commonly used for top-level windowsit' also possible to create menu bar as horizontal frame before show you howthoughlet me explain why you should care because this frame-based scheme doesn' depend on top-level window protocolsit can also be used to add menus as nested components of larger displays in other wordsit' not just for top-level windows for example' pyedit text editor can be used both as program and as an attachable component we'll use window menus to implement pyedit selections when pyedit is run as standalone programbut we'll use frame-based menus when pyedit is embedded in the pymailgui and pyview displays both schemes are worth knowing frame-based menus require few more lines of codebut they aren' much more complex than window menus to make onesimply pack menubutton widgets within frame containerassociate menu widgets with the menubuttonsand associate the frame with the top of container window example - creates the same menu as example - but using the frame-based approach example - pp \gui\tour\menu_frm py frame-based menusfor top-levels and components from tkinter import from tkinter messagebox import get widget classes get standard dialogs def notdone()showerror('not implemented''not yet available'def makemenu(parent)menubar frame(parentmenubar pack(side=topfill=xrelief=raisedbd= fbutton menubutton(menubartext='file'underline= fbutton pack(side=leftfile menu(fbuttonfile add_command(label='new 'command=notdoneunderline= file add_command(label='open 'command=notdoneunderline= file add_command(label='quit'command=parent quitunderline= fbutton config(menu=fileebutton menubutton(menubartext='edit'underline= ebutton pack(side=leftedit menu(ebuttontearoff=falseedit add_command(label='cut'command=notdoneunderline= edit add_command(label='paste'command=notdoneunderline= edit add_separator(ebutton config(menu=edit tkinter tourpart