Why do my Tkinter widgets get stored as None? [duplicate] Why do my Tkinter widgets get stored as None? [duplicate] tkinter tkinter

Why do my Tkinter widgets get stored as None? [duplicate]


The grid, pack, and place methods of every Tkinter widget operate in-place and always return None. This means that you cannot call them on the same line as you create a widget. Instead, they should be called on the line below:

widget = ...widget.grid(...)widget = ...widget.pack(...)widget = ...widget.place(...)

So, in your code, it would be:

b[c+(r*10)] = Button(f, text=chr(97+c+(r*10)), command=lambda a=c+(r*10): color(a), borderwidth=1,width=5,bg="white")b[c+(r*10)].grid(row=r,column=c)