[英]Create a list of checkboxes in Python 3.4
I am using Python 3.4 and tkinter 我正在使用Python 3.4和tkinter
I want to create a list of checkboxes. 我想创建一个复选框列表。 However when, just to check, I made a list and displayed it
但是,当只是为了检查时,我列出了清单并显示了它
checkbox = [Checkbutton(mainwindow, text = "x")]
checkbox(0).grid(row = 0, column = 0)
It gave me error: 它给了我错误:
Traceback (most recent call last):
File "D:/Users/iamhssingh/Documents/Python/GUICreator/main.py", line 38, in <module>
checkbox(0).grid(row = 0, column = 0)
TypeError: 'list' object is not callable
要访问列表的元素,请使用方括号而不是括号:
checkbox[0].grid(row = 0, column = 0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.