wxPython - Enable() function in wx.MenuItem Last Updated : 04 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn about Enable() function associated with the wx.MenuItem class of wxPython. As the name Enable suggests Enable() function enables or disables the menu item. It only takes a boolean parameter enable, True for Enable and False for Disable. Syntax: wx.MenuItem.Enable(self, enable=True) Parameters: Parameter Input Type Description enable bool True for Enable and False for Disable. Code Example: Python3 1== import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() self.item = wx.MenuItem(self.fileMenu, 1, '&Check') self.fileMenu.Append(self.item) # Disable menu item using Enable() function self.item.Enable(enable = False) self.menubar.Append(self.fileMenu, '&File') self.SetMenuBar(self.menubar) self.SetSize((350, 250)) self.SetTitle('Icons and shortcuts') self.Centre() 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 - Enable() function in wx.MenuItem R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads wxPython - Check() function in wx.MenuItem In this article we are going to learn about Check function associated with the wx.MenuItem class of wxPython. As the name Check suggests Check() function checks or unchecks the menu item(ITEM_CHECK). Note that this only works when the item is already appended to a menu. Syntax: wx.MenuItem.Check(sel 1 min read wxPython - GetId() function in wx.MenuItem In this article we are going to learn about GetId() function associated with wx.MenuItem class of wxPython. As the name suggests GetId() function returns the menu item identifier of int type.No parameters are required in GetId() function. Syntax: wx.MenuItem.GetId() Parameters: No parameters are req 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 - GetMenu() function in wx.MenuItem In this article we are going to learn about GetMenu() function associated with wx.MenuItem class of wxPython. GetMenu() function returns the menu this menu item is in, or None if this menu item is not attached. No arguments are needed in GetMenu() function. Syntax: wx.MenuItem.GetMenu(self) Paramete 1 min read wxPython - Detach() function in wx.MenuBar In this article we are going to learn about Detach() function associated with wx.MenuBar class of wxPython. Detach() function simply detaches the menubar associated/attached with the frame. Detach() function takes no arguments. Syntax: wx.MenuBar.Detach(self) Parameters: Detach() function takes no a 1 min read Like