I've been googling around for over an hour at this point, but I can't figure this out. I want to display the result of the function as the label's text. The problem is that even though the return of the function is for example: 250.2, when I place the label into the tkinter window, it looks more like (numbers)< lambda >, which I think is a function object.
The label:
self.temperature = ttk.Label(
self,
text=lambda:self.displayInfo(0))
The function:
def displayInfo(self, index):
self.infoList = WeatherInfo.jsonToString(self)
return self.infoList[index]
Thanks in advance.
CodePudding user response:
You are passing a lambda
where a string is expected. If you want the result of the function, then just call the function:
self.temperature = ttk.Label( self, text=self.displayInfo(0) )