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 pressed button is automatically released. You should avoid having the radio groups of only one element as it would be impossible for the user to use such button.
Syntax : wx.ToolBar.AddRadioTool(self, toolId, label, bitmap1, bmpDisabled=NullBitmap, 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. |
| bitmap1 |
wx.bitmap |
The primary tool bitmap. |
| bmpDisabled |
wx.bitmap |
The bitmap used when the tool is disabled. |
| 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. |
Return Type : wx.ToolBarToolBase
Code Example :
Output :
Tick is clicked:
👁 Image
Cross is Clicked:
👁 Image