I have a Label that show the status of my db connection. I need to update the text of this Label whenever something happens, but also I want to change the color of this label. I'm using update_idletasks()
method, but it just change the text not the color.
self.dtbase_value = StringVar()
self.dtbase_color = StringVar()
self.dtbase_bg = StringVar()
self.dtbaselbl = Label(self.right_frame, textvariable = self.dtbase_value, fg = self.dtbase_color.get(), bg = self.dtbase_bg.get()).pack(side=TOP)
This is the part that I call the update.
self.dtbase_value.set(self.get_current_time() + ': connection established')
self.dtbase_color.set('SpringGreen')
root.update_idletasks()
Is there any specific method to dinamically update the attributes of a Label component?