Python Tkinter Checkbutton
The Checkbutton is used to track the user's choices provided to the application. In other words, we can say that Checkbutton is used to implement the on/off selections.
The Checkbutton can contain the text or images. The Checkbutton is mostly used to provide many choices to the user among which, the user needs to choose the one. It generally implements many of many selections.
The syntax to use the checkbutton is given below.
A list of possible options is given below.
||It represents the background color when the checkbutton is under the cursor.
||It represents the foreground color of the checkbutton when the checkbutton is under the cursor.
||The background color of the button.
||It displays an image (monochrome) on the button.
||The size of the border around the corner.
||It is associated with a function to be called when the state of the checkbutton is changed.
||The mouse pointer will be changed to the cursor name when it is over the checkbutton.
||It is the color which is used to represent the text of a disabled checkbutton.
||It represents the font of the checkbutton.
||The foreground color (text color) of the checkbutton.
||It represents the height of the checkbutton (number of lines). The default height is 1.
||The color of the focus highlight when the checkbutton is under focus.
||The image used to represent the checkbutton.
||This specifies the justification of the text if the text contains multiple lines.
||The associated control variable is set to 0 by default if the button is unchecked. We can change the state of an unchecked variable to some other one.
||The associated control variable is set to 1 by default if the button is checked. We can change the state of the checked variable to some other one.
||The horizontal padding of the checkbutton
||The vertical padding of the checkbutton.
||The type of the border of the checkbutton. By default, it is set to FLAT.
||The color of the checkbutton when it is set. By default, it is red.
||The image is shown on the checkbutton when it is set.
||It represents the state of the checkbutton. By default, it is set to normal. We can change it to DISABLED to make the checkbutton unresponsive. The state of the checkbutton is ACTIVE when it is under focus.
||It represents the index of the character in the text which is to be underlined. The indexing starts with zero in the text.
||It represents the associated variable that tracks the state of the checkbutton.
||It represents the width of the checkbutton. It is represented in the number of characters that are represented in the form of texts.
||If this option is set to an integer number, the text will be broken into the number of pieces.
The methods that can be called with the Checkbuttons are described in the following table.
||It is called to turn off the checkbutton.
||The checkbutton is flashed between the active and normal colors.
||This will invoke the method associated with the checkbutton.
||It is called to turn on the checkbutton.
||It is used to toggle between the different Checkbuttons.