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:
Output :
👁 Image