0

I am using Python 3.4 and 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
2
  • 5
    it should be checkbox[0].grid(row = 0, column = 0) Commented Jun 23, 2015 at 6:52
  • Or checkbox = Checkbutton(mainwindow, text = "x") Commented Jun 23, 2015 at 8:15

1 Answer 1

2

To access an element of a list, use square brackets rather than parentheses:

checkbox[0].grid(row = 0, column = 0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.