Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python – AddCheckTool() function in wxPython

  • Last Updated : 15 May, 2020

In this article we are going to learn about AddCheckTool() in wx.ToolBar class of wxPython. AddCheckTool() function is used to add check tools. A checktool is a kind of toggle button. A checktool have a on and off state.

Syntax : wx.ToolBar.AddCheckTool(self, toolId, label, bitmap1, bmpDisabled=NullBitmap, shortHelp=””, longHelp=””, clientData=None)

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Parameters :

ParameterInput TypeDescription
toolidintAn integer by which the tool may be identified in subsequent operations.
labelstringThe string to be displayed with the tool.
bitmap1wx.bitmapThe primary tool bitmap.
bmpDisabledwx.bitmapThe bitmap used when the tool is disabled.
shortHelpstringThis string is used for the tools tooltip.
longHelpstringdetailed string associated with tool.
clientDataPyUserDataAn optional pointer to client data which can be retrieved later using GetToolClientData.

Return Type : wx.ToolBarToolBase

Code Example:

import wx
class Example(wx.Frame):
    global count
    count = 0;
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        pnl = wx.Panel(self)
        self.toolbar = self.CreateToolBar()
        # create check toolusing AddCheckTool() function
        rtool = self.toolbar.AddCheckTool(12, 'CheckTool'
                   bitmap1 = wx.Bitmap('/Desktop/wxPython/right.png'), 
                   bmpDisabled = wx.Bitmap('/Desktop/wxPython/wrong.png'))
        self.SetSize((350, 250))
        self.SetTitle('Simple toolbar')
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':

Output :
unchecked :

checked :

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!