Python - MenuBars in wxPython Last Updated : 10 May, 2020 Comments Improve Suggest changes Like Article Like Report 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 MenuBar() constructor: wx.MenuBar(style=0) Syntax for Append() function: wx.MenuBar.Append(self, menu, title) Parameters: Parameter Input Type Description menu wx.Menu The menu to add. Do not deallocate this menu after calling Append . title string The title of the menu, must be non-empty. Code Example: Python3 # import wxPython import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): # create MenuBar using MenuBar() function menubar = wx.MenuBar() fileMenu = wx.Menu() # add menu to MenuBar menubar.Append(fileMenu, '&Menu# 1') self.SetMenuBar(menubar) self.SetSize((300, 200)) self.SetTitle('Menu Bar') def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output : Comment More infoAdvertise with us Next Article Python - MenuBars in wxPython R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads 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 - GetMenu() function in wxPython In this particular article we are going to learn about GetMenu() function of wx.MenuBar class of wxPython. GetMenu() is function in wx.MenuBar class that return wx.Menu object present in Menubar. It needs only index of menu present on menubar. Syntax : wx.MenuBar.GetMenu(self, menuindex) Parameters 1 min read wxPython | GetMargins() function in python In this article we are going to learn about GetMargins() function of class wx.ToolBar in wxPython. GetMargins() function returns the left/right and top/bottom margins, which are also used for inter-toolspacing. GetMargins takes no parameters. Syntax: wx.ToolBar.GetMargins(self) Parameters: No Parame 2 min read Python - Move() function in wxPython In this particular article we will learn, how can we move our window to a particular point. This can be achieved using Move() function in wx.Window class of wxPython. Move() takes x and y points to move window to a particularx, y point. Syntax : wx.Move(self, x, y, flags=SIZE_USE_EXISTING) Parameter 1 min read 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 Like