Tkinter Checkbutton Options

Tkinter Checkbutton Options

In this tutorial, you shall learn about the options of a Checkbutton widget, and what each option does to the Checkbutton.

To create a Checkbutton, all we need to pass to the Checkbutton() is the master widget. But, it just displays a bare button without any text or much functionality. We can make this Checkbutton usable, or style it to the requirements of our application using options of the Checkbox().

The following table presents all the options of the Checkbox widget.

Option Description
1 activebackground The background color when the Checkbutton is active.
2 activeforeground The foreground (text) color of the Checkbutton when the Checkbutton is active.
3 bg The background color of Checkbutton.
4 bitmap It displays an image (monochrome) on the Checkbutton.
5 bd The size of the border around the Checkbutton.
6 command A callback function to be called when the state of the Checkbutton is changed.
7 cursor The cursor to be displayed when mouse is over the the Checkbutton.
8 disableforeground The foreground (text) color of the Checkbutton when the Checkbutton is disabled.
9 font The font used for the text of Checkbutton.
10 fg The foreground color used for the text of the Checkbutton.
11 height Height of the checkbutton in number of lines.
12 highlightcolor The color of the focus highlight when the Checkbutton get focus.
13 image The image is displayed on the Checkbutton.
14 justify The alignment of the text when in Checkbutton.
15 offvalue The value to be set when the Checkbutton is unchecked. Default value is 0.
16 onvalue The value to be set when the Checkbutton is checked. Default value is 1.
17 padx The padding along X-axis (horizontal) of the Checkbutton.
18 pady The padding along Y-axis (vertical) of the Checkbutton.
19 relief Type of the border for the Checkbutton. Default value is FLAT.
20 selectcolor Color of the checkbutton when it is selected/checked.
21 selectimage Image to be displayed for the checkbutton when it is selected/checked.
22 state The state of the Checkbutton. Default value is normal. You may display the Checkbutton by setting this state to DISABLED.
24 underline Index of the character in the text of Checkbutton, which is to be underlined.
25 variable Variable associated with the Checkbutton that tracks whether it is checked or not.
26 width Width of the Checkbutton in the units of number of characters.
27 wraplength Number of characters to be allowed in a single line, when there is longer text that takes more than one line.

Summary

In this Python Tkinter tutorial, we have seen the options of a Checkbutton widget.

Related Tutorials

Privacy Policy Terms of Use

SitemapContact Us