Skip to content
Related Articles

Related Articles

Improve Article

wxPython – GetItemLabel() function in wx.MenuItem

  • Last Updated : 09 Jun, 2020

In this artile we are going to learn about GetItemLabel() function associated with the wx.MenuItem class of wxPython. GetItemLabel() function simply returns the text associated with the menu item including any accelerator characters that were passed to the constructor or SetItemLabel .
GetItemLabel() function takes no parameters.




No Parameters are required in wx.MenuItem.

Return Type:


Code Example:

import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    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', helpString ="Check Help")
        self.item.SetBitmap(wx.Bitmap('right.png')) = wx.StaticText(self, label ="", pos =(20, 20), style = wx.ALIGN_LEFT)
        self.menubar.Append(self.fileMenu, '&File')
        # label associated with 'item' menuitem
        label = self.item.GetItemLabel()
        # print label
        self.SetSize((350, 250))
        self.SetTitle('Icons and shortcuts')
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':



Output window:

 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

My Personal Notes arrow_drop_up
Recommended Articles
Page :