I want to change the color of a text in a given label of a Tkinter using dynamic function

Say I have a string s where the data may comes from any serial interface "A or D" If A arrives in my string I want to print that in green and if D comes in that string I want to print it in blue.

Here is the label code

label(text=s,width=40).grid(row=1,column=0)

I just want to change the color of that text using any function in tkinter? Is it possible

There is a old thread Click Here with an answer.

Edit: you can also try hex colors such as '#00ff00'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.