Instead of making a new label each time updateSearchLabel
is called, make the Label
once, and retain a reference to the StringVar
:
def createSearchLabel(self):
self.lblSearchText = StringVar()
self.lblSearch = Label(self.gpBt, textvariable=self.lblSearchText)
self.lblSearch.grid(row=0, column=0, sticky=W, padx=(10,0), pady=(5,0))
and then call set
from within updateSearchLabel
:
def updateSearchLabel(self, textVar):
self.lblSearchText.set(textVar)