You have two main problems with your code. It needs to be restructured, and you're making a very common mistake with laying out your widgets.
Organizing your code
The way you have your code structured, your call to configure
happens after mainloop
exits, and after the widgets have been destroyed. You need to reorganize your code so that the call to mainloop
is the last line of code that is executed.
In my opinion this is best accomplished by using classes and objects, but that's not strictly necessary. You simply need to not have any code after you call mainloop
.
Laying out the widgets
The problem is this line:
chiplabel = Label( root, relief=RIDGE, width = 9 , text ="Unknown", padx=0, pady=0).grid(row = 0,column=5, sticky =W)
In python, when you do x=y().z()
, x
is given the value of z()
. So, when you do chiplabel = Label(...).grid(...)
, chiplabel
is given the value of grid(...)
. Grid always returns None
, so chiplabel
will always be None
. Because of this, you can't reconfigure it because you've lost the reference to the widget.
The solution is to create the widget and lay out the widget in two steps.