Menus and Submenus in Tkinter The menu is used to navigate something in the GUI window. The 'Menu ' widget is used to create a menu. syntax: menu = Menu(name_of_window) # To add items use following and other attributes are used menu.add_command(label,command) # Following is the method to pack the menu name_of_window.configue(menu='name-of-menu') How to create a menu in Tkinter? *************************** a = Menu(root) a.add_commmand(label='file',command=None) a.add_commmand(label='help',command=None) root.configue(menu=a) *************************** How to create a sub_menu in Tkinter? To create a sub-menu used the following syntax name_of_submenu = Menu(name_of_main_menu) # Use some attributes to add item,option to submenu name_of_submenu.add_command(label,command) How to pack the sub_menu? To create a sub-menu used the following syntax # This will add main menu to the window name_of _window.configue(main_menu) # Thi...
Comments
Post a Comment