Skip to content
Related Articles

Related Articles

wxPython | GetToolLongHelp() function with python

Improve Article
Save Article
Like Article
  • Last Updated : 04 Jun, 2020

In this article we are going to learn about GetToolLongHelp() function present in wx.ToolBar class of wxPython. GetToolLongHelp() function returns the long help for the given tool. It takes only one argument that is toolid( ID of the tool in question, as passed to AddTool ).

Syntax:

wx.GetToolLongHelp(self, toolid)

Parameters :

ParameterInput TypeDescription
toolidintAn integer by which the tool may be identified in subsequent operations.

Return Type:

string

Code Example 1:




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()
        self.toolbar.SetMargins(10, 10)
        # Add Tools Using AddTool function
        rtool = self.toolbar.AddLabelTool(id = 13, label = "Tool one", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 1", longHelp = "Long help associated with simple tool 1")
        stool = self.toolbar.AddLabelTool(id = 14, label = "Tool two", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 2", longHelp = "Long help associated with simple tool 2")
  
        self.toolbar.Realize()
        self.SetSize((350, 250))
        self.SetTitle('Control')
        self.Centre()
  
        bl = self.toolbar.GetToolLongHelp(13)
  
        # print tool longHelp string
        print(bl)
  
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

Output:

Long help associated with simple tool 1

Code Example 2:




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()
        self.toolbar.SetMargins(10, 10)
        # Add Tools Using AddTool function
        rtool = self.toolbar.AddLabelTool(id = 13, label = "Tool one", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 1", longHelp = "Long help associated with simple tool 1")
        stool = self.toolbar.AddLabelTool(id = 14, label = "Tool two", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 2", longHelp = "Long help associated with simple tool 2")
  
        self.toolbar.Realize()
        self.SetSize((350, 250))
        self.SetTitle('Control')
        self.Centre()
  
        bl = self.toolbar.GetToolLongHelp(14)
  
        # print tool longHelp string
        print(bl)
  
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

Output:

Long help associated with simple tool 2

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!