wxPython - Add submenu in Menu Last Updated : 15 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn How can we add submenu to a Menuitem inside a Menu present on MenuBar. In this we use AppendMenu() function rather than just using Append(). Steps : 1. Create a MenuBar in frame using MenuBar() constructor. 2. Add menu to the menu bar. 3. Create wx.Menu for Menuitem. 4. Add menu using AppendMenu() function. Syntax : wx.Menu.AppendMenu(self, id, subMenu, helpString) Parameters of AppendMenu(): ParameterInput TypeDescriptionidintThe menu item identifier.itemstringthe string to appear on the menu item;subMenuwx.Menuan instance of FlatMenu, the submenu to append,helpStringintan optional help string associated with the item. By default, the handler for the EVT_FLAT_MENU_ITEM_MOUSE_OVER event displays this string in the status line. Code Example: Python3 import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): menubar = wx.MenuBar() fileMenu = wx.Menu() # submenu for menuitem imp = wx.Menu() imp.Append(wx.ID_ANY, 'SubMenu 1') imp.Append(wx.ID_ANY, 'SubMenu 2') imp.Append(wx.ID_ANY, 'SubMenu 3') # append submenu with menuitem fileMenu.AppendMenu(wx.ID_ANY, 'MenuItem', imp) menubar.Append(fileMenu, '&Menu') self.SetMenuBar(menubar) self.SetSize((350, 250)) self.SetTitle('Submenu') self.Centre() def OnQuit(self, e): self.Close() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output : Comment More infoAdvertise with us Next Article wxPython - SetMenu() function in wx.MenuItem R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads wxPython - Add Sub-Menu in menubar In this article we will learn how can we add submenu item to menu item present on menubar. We can do this by same Append() function present in wxMenuBar class. Syntax: wx.MenuBar.Append(self, menu, title)Parameters: ParameterInput TypeDescriptionmenuwx.MenuThe menu to add. Do not deallocate this men 1 min read wxPython - SetSubMenu() function in wx.MenuItem In this article we are going to learn about SetSubMenu() function associated with wx.MenuItem class of wxPython. SetSubMenu() is simply used to set the submenu of this menu item. It takes only one argument that is wx.Menu you want to add submenu for item. Syntax: wx.MenuItem.SetSubMenu(self, menu) P 1 min read wxPython - SetMenu() function in wx.MenuItem In this article we are going to learn about SetMenu() function associated with wx.MenuItem class of wxPython. SetMenu() function sets the parent menu which will contain this menu item. It takes a single wx.Menu object as parameter. Syntax: wx.MenuItem.SetMenu(self, menu) Parameters: Parameter Input 1 min read wxPython - Add image with menuitem in wx.MenuBar In this article we are going to learn that how can we add a bitmap image with the menuitem associated with the menu present in menubar object of wx.MenuBar class. Steps : 1. Create a menubar object of wx.MenuBar class. 2. Create a menu object of wx.Menu class. 3. Create a MenuItem using wx.MenuItem 1 min read Python - popup menu in wxPython In this article we are going to know how can we create a popupmenu in wxPython. We will write a code when we click right on screen a popup menu will show up with menu items names as 'one' and 'two'. Syntax : wx.Window.PopupMenu(self, menu, pos) Parameters : ParameterInput TypeDescriptionmenuwx.MenuM 1 min read Python - MenuBars in wxPython One of the most important part in a GUI is a menubar, which are used to perform various operations on a Window. In this article we will learn how to create a menubar and add menu item to it. This can be achieved using MenuBar() constructor and Append() function in wx.MenuBar class. Syntax for MenuBa 1 min read Like