AttributeError: 'NoneType' object has no attribute 'grid_remove'

后端 未结 1 1020
难免孤独
难免孤独 2021-01-21 23:28

I have only done a little work with Tkinter and I enjoy using it but as with any type programing it takes time to learn. I am trying to create a simple To do list that will even

1条回答
  •  别那么骄傲
    2021-01-22 00:25

    The problem is this line:

    tdEnter = Button(ToDoFrame,text="Add Task",command=tdTaskAdd).grid(row=TDrow+2,column=1)
    

    This way, tdEnter is not the Button, but the return value of grid, i.e. None.

    Try this instead:

    tdEnter = Button(ToDoFrame,text="Add Task",command=tdTaskAdd)
    tdEnter.grid(row=TDrow+2,column=1)
    

    Same for label and when you create a new button in your tdAddTask function.

    BTW, no need to add a new button each time, just call it's grid method to repositon it.

    0 讨论(0)
提交回复
热议问题