How to create multiple Selection Checkboxes in Tkinter Python

In this tutorial, we will learn about multiple selection checkboxes in Tkinter using Python. Tkinter is an open-source library in Python that is used for Graphical User Interface(GUI). Using this library one can create a lot like that are required for the user interface. Tkinter also provides the feature of CheckBoxes which we are going to learn here. To create multiple selection checkboxes we will use radio buttons. Generally to select multiple checkboxes we will create a list. In this list, we use multiple select checkboxes we need to select more than one item. To do this we will set the checkbox as multiple this supports selecting more than one item from the list.

We will discuss more using examples.Python: Radio buttons in Tkinter This link will help to get more understanding about Tkinter.

Python code for Multiple checkboxes using Tkinter in Python


#Importing all required libraries
from tkinter import *

#Creating a window 
win = Tk()

#Here we select multiple mode to select more than one option
#creating a list of items that we want to display on the window
opt = Listbox(win,selectmode="multiple")
#Now we will add this into window as it would expand accordingly in both axis
#insering each items into options this will add into list that get displayed
for i in lis:
#keeping the window into main loop this will keep window displayed

Here I have selected “Tkinter”, “Pandas” and “Numpy”. You can also deselect those by clicking again on the selected item in the list. Here you can see the elements that I have selected in the output image.

Here is the image of Output.How to create multiple Selection Checkboxes in Tkinter Python

Here in this image, you can see the multiple select checkboxes. You can also try a lot using these.

Leave a Reply

Your email address will not be published.