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
