Friday, October 17, 2025
HomeLanguageswxPython – SetHelpString() function in wx.MenuBar

wxPython – SetHelpString() function in wx.MenuBar

In this article we are going to learn about another function of class wx.MenuBar in wxPython, that is, SetHelpString(). Set help string associates a Help string along with menu item which is further used for various purposes.

Syntax :

wx.MenuBar.SetHelpString(self, id, helpString)

Parameter :

Parameter Input Type Description
id int Menu item identifier.
helpString string Help string to associate with the menu item.

Code Example :




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()
  
        # add menu to MenuBar
        fm1 = wx.Menu()
        fileitem = fm1.Append(20, "Item # 1")
        menubar.Append(fm1, '&Menu # 1')
        self.SetMenuBar(menubar)
        self.SetSize((300, 200))
        self.SetTitle('Menu Bar')
  
        # set helpstring using SetHelpString() function
        menubar.SetHelpString(20, "Help String")
        st = wx.StaticText(self, label ="click Item # 1 in Menu # 1")
        print(menubar.GetHelpString(20))
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()


Output :

Last Updated :
11 May, 2020
Like Article
Save Article

<!–

–>

Similar Reads
Related Tutorials
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS