Dear Pythoners,

I have a list of dictionaries. Here i have a variable which should gather
input from  Checkbutton widget in Tkinter. The Problem that I'm facing is
that I'm unable to set or reset the key in every dictionary using the
checkbutton widget.

Here is what i have been doing.

list_of_dict=[{'Flag':0},{'Flag':0}, {'Flag':0}]
root=Tkinter.Tk()

while i<3:
    q=Tkinter.IntVar()
    w=Tkinter.Checkbutton(root, text='Need to include this value?',
onvalue=1, offvalue=0, variable=q)
    w.grid(row=i)
    list_of_dict[i]['Flag']=q.get()
root.mainloop()

Could you please let me know what I'm doing wrong?
I have tried multiple ways of accomplishing this for eg. by having a command
option which will just toggle the
list_of_dict[i]['Flag']=not(list[i]['Flag'])

Please let me know the best way of doing this.
Thanks in advance :)

Warm Regards,
Abhijeet.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to