Tkinter

Checkbutton Tkinter | Python 3

In this tutorial, we are going to see how to use Checkbutton widget in Tkinter. The Checkbutton widget is used to display a number of options to a user as a checkbox. The user can then select one or more options by clicking on the corresponding button for each option.
 


 
 

Syntax:

Here is the syntax to create this widget:

check = Checkbutton ( master, option = value, ... )

 

Parameters:
  • master : This represents the parent window.
  • options : Options can be used as comma separated key-value pairs. See the following example:

 

 

Example :
from tkinter import *

gui = Tk()

c1 = Checkbutton(gui, text = "Python", height = 2, width = 10)
c2 = Checkbutton(gui, text = "Java", height = 2, width = 10)
c3 = Checkbutton(gui, text = "PHP", height = 2, width = 10)

c1.pack()
c2.pack()
c3.pack()

gui.mainloop()

Output:


 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *