wxPython - AddTool() function in wx.ToolBar Last Updated : 17 May, 2020 Comments Improve Suggest changes Like Article Like Report AddTool() is another function in wx.ToolBar class of wxPython. AddTool() function simply adds a tool to the Toolbar. This is another version of AddTool() function with greater number of parameters. it adds parameters like : bmpDisabled, longHelp, clientData. Syntax: wx.ToolBar.AddTool(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None) Parameters : Parameter Input Type Description toolid int An integer by which the tool may be identified in subsequent operations. label string The string to be displayed with the tool. bitmap wx.bitmap The primary tool bitmap. bmpDisabled wx.bitmap The bitmap used when the tool is disabled. kind int kind of toolbar. shortHelp string This string is used for the tools tooltip. longHelp string detailed string associated with tool. clientData PyUserData An optional pointer to client data which can be retrieved later using GetToolClientData. Code Example: Python3 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): pnl = wx.Panel(self) self.toolbar = self.CreateToolBar() # Radio tool using AddTool() Function ptool = self.toolbar.AddTool(12, 'oneTool', wx.Bitmap('/home/wxPython/right.png'), wx.Bitmap('/home/wxPython/wrong.png'), kind = wx.ITEM_RADIO, shortHelp ="Simple Tool") spc = self.toolbar.AddStretchableSpace() # Check tool using AddTool() Function qtool = self.toolbar.AddTool(12, 'oneTool', wx.Bitmap('/home/wxPython/right.png'), wx.Bitmap('/home/wxPython/wrong.png'), kind = wx.ITEM_CHECK, shortHelp ="Simple Tool") spc = self.toolbar.AddStretchableSpace() # Normal tool using AddTool() Function rtool = self.toolbar.AddTool(12, 'oneTool', wx.Bitmap('/home/wxPython/right.png'), wx.Bitmap('/home/wxPython/wrong.png'), kind = wx.ITEM_NORMAL, shortHelp ="Simple Tool") self.toolbar.Realize() self.SetSize((350, 250)) self.SetTitle('Control') self.Centre() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output : Comment More infoAdvertise with us Next Article wxPython - AddTool() function in wx.ToolBar R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wand Practice Tags : python Similar Reads wxPython - AddLabelTool() function in wx.ToolBar In this article we are going to learn about another method in wx.ToolBar class of wxPython, that is, AddLabelTool() method. AddLabelTool() is old style method to add a tool to the toolbar. Syntax: wx.ToolBar.AddLabelTool(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortH 1 min read wxPython - AddRadioTool() function in wx.ToolBar In this particular article we are going to learn working of AddRadioTool() in wx.ToolBar class of wxPython. AddRadioTool() function creates a radio group such that exactly one button in the group is pressed at any moment, in other words whenever a button in the group is pressed the previously presse 2 min read wxPython - AddSimpleTool() function in wx.ToolBar In this article we are going to learn about another method in wx.ToolBar class of wxPython, that is, AddSimpleTool() method. AddSimpleTool() is old style method to add a tool to the toolbar. Syntax: wx.ToolBar.AddSimpleTool(self, id, bitmap, shortHelpString="", isToggle=0) Parameters : ParameterInpu 1 min read wxPython | CreateTool() function in wx.Toolbar In this particular article we are going to learn about CreateTool() function in wx.ToolBar class in wxPython. CreateTool() function is a factory function to create a new toolbar tool. CreateTool() function only creates a tool which is further added using AddTool() function. Syntax: wx.ToolBar.Create 2 min read wxPython - EnableTool() function in wx.Toolbar In this article we are going to learn EnableTool() function of class wx.ToolBar of wxPython. EnableTool is used to enable or disable(make clickable and unclickable) the tool present in toolbar. Syntax : wx.ToolBar.EnableTool(self, toolid, enable) Parameters : ParameterInput TypeDescriptiontoolidintI 1 min read Like