Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

wxPython – IsSubMenu() function in wx.MenuItem

  • Last Updated : 09 Jun, 2020

In this article we are going to learn about IsSubMenu() function associated with wx.MenuItem class of wxPython. IsSubMenu() function simply returns True if the item is a submenu and False if the item is not a submenu.
No parameters are required by IsSubMenu() function.


 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course



No parameters are required by IsSubMenu() function.

Return Type:


Code Example:

import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        menubar = wx.MenuBar()
        fileMenu = wx.Menu()
        sm = wx.Menu()
        sm.Append(wx.ID_ANY, 'Submenu item 1')
        sm.Append(wx.ID_ANY, 'Submenu item 2')
        sm.Append(wx.ID_ANY, 'Submenu item 3')
        item = wx.MenuItem(fileMenu, 1, '&Check\tCtrl + c', helpString ="Check Help")
        fileMenu.AppendMenu(wx.ID_ANY, 'I&mport', sm)
        n = item.IsSubMenu()
        # if item is sub menu
        if(n == True):
            print("Item is SubMenu Item")
            print("Item is not a SubMenu Item")
        menubar.Append(fileMenu, '&File')
        self.SetSize((350, 250))
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':


Item is SubMenu Item.

Output Window:

My Personal Notes arrow_drop_up
Recommended Articles
Page :