Thursday, September 4, 2025
HomeLanguageswxPython | GetToolShortHelp() function in wx.ToolBar

wxPython | GetToolShortHelp() function in wx.ToolBar

In this article we are going to learn about GetToolShortHelp() function associated with wx.ToolBar class of wxPython. GetToolShortHelp() function returns the short help string associated with a particular tool. It takes only toolId as a parameter.

Syntax

wx.ToolBar.GetToolShortHelp(self, toolId)

Parameters :

Parameter Input Type Description
toolId int Identifier for tool in toolbar.

Return Type:

string

Code Example 1: 

Python3




import wx
 
 
class Example(wx.Frame):
    global count
    count = 0;
 
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
 
        self.InitUI()
 
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pnl = wx.Panel(self)
        self.toolbar = self.CreateToolBar()
        # Add Tools Using AddLabelTool function
        rtool = self.toolbar.AddLabelTool(13, 'oneTool', wx.Bitmap('wrong.png'), shortHelp ="short help string one")
        stool = self.toolbar.AddLabelTool(14, 'twoTool', wx.Bitmap('user.png'), shortHelp ="short help string two")
 
        self.toolbar.Realize()
        self.SetSize((350, 250))
        self.SetTitle('Control')
        self.Centre()
 
        str = self.toolbar.GetToolShortHelp(13)
 
        # print wx.ToolBarToolBase object of tool
        print(str)
 
 
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
 
 
if __name__ == '__main__':
    main()


Output :

short help string one

Code Example 1: 

Python3




import wx
 
 
class Example(wx.Frame):
    global count
    count = 0;
 
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
 
        self.InitUI()
 
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pnl = wx.Panel(self)
        self.toolbar = self.CreateToolBar()
        # Add Tools Using AddLabelTool function
        rtool = self.toolbar.AddLabelTool(13, 'oneTool', wx.Bitmap('wrong.png'), shortHelp ="short help string one")
        stool = self.toolbar.AddLabelTool(14, 'twoTool', wx.Bitmap('user.png'), shortHelp ="short help string two")
 
        self.toolbar.Realize()
        self.SetSize((350, 250))
        self.SetTitle('Control')
        self.Centre()
 
        str = self.toolbar.GetToolShortHelp(13)+" "+self.toolbar.GetToolShortHelp(14)
 
        # print short help string
        print(str)
 
 
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
 
 
if __name__ == '__main__':
    main()


Output :

short help string one short help string two
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS