开发者

Add multiple Checkbutton and store the result in a list

I want to add several Checkbutton in my Tkinter app. I don't know the number of Checkbutton I insert when I launch the program (depend on a DB call).

I wrote this code:

for row in information:
    self.__checkBoxValue.append(StringVar())
    Checkbutton(self.__frame2, variable=self.__checkBoxValue[-1], onvalue="%s*%s" % (row[0], row[1])).grid(row=TDMUsed[row[0]], column=DateUsed[row[2]])

When I run the code, all the checkbox are grayed and checked. But,开发者_如何学Go If I delete the variable option, the checkbox is ok.


Try setting the value of the StringVar instance to either your onvalue or offvalue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜