need some help in coding tkinter checkbox. i am having a check button which if i select, it will enable many other check box. below is the function after selecting the first check box
def enable_():
# Global variables
global var
# If Single test
if (var.get()==1):
Label (text='Select The Test To Be Executed').grid(row=7,column=1)
L11 = Label ().grid(row=9,column=1)
row_me =9
col_me =0
test_name_backup = test_name
for checkBoxName in test_name:
row_me = row_me+1
chk_bx = Checkbutton(root, text=checkBoxName, variable =checkBoxName, \
onvalue = 1, offvalue = 0, height=1, command=box_select(checkBoxName), \
width = 20)
chk_bx.grid(row = row_me, column = col_me)
if (row_me == 20):
row_me = 9
col_me = col_me+1
i have two question here.
How to delete the dynamically created check boxes (chk_bx ) i mean if i select the initial check box it will enable many other boxes , if i deselect the first check box it should remove the initially created boxes?
How will i get the value from the dynamically creaed box "selected / not"?
L11isNonesince that is what.gridreturns. Your Checkbutton command is executed when you create the Checkbutton ... You probably wantlambda name=checkBoxName:box_select(name)varas a variable name... Nor should you use global variables. You can just pass the variable into the function.