I have this dictionary
myDict = {'key1' : 'val1', 'key2' : 'val2', 'key3' : 'val3'}
and I am iteratively using 'key' and 'value' of 'myDict' to create check and radio buttons.
for key, value in myDict.items():
myDict[key] = Variable()
myDict[value] = Variable()
c = Checkbutton(root, text=key, variable=myDict[key], onvalue=key, offvalue="").pack(anchor=W)
Radiobutton(root, text='radio1', variable=myDict[value], value=1).pack(anchor=E)
Radiobutton(root, text='radio2', variable=myDict[value], value=2).pack(anchor=E)
var_list.append(myDict[key]) #var_list is an empty list defined already
print(var_list)
and I am getting this error
Traceback (most recent call last):
File "Check_box_lis_0305.py", line 21, in <module>
for key, value in myDict.items():
RuntimeError: dictionary changed size during iteration
Could you please help me to resolve this.