Tkinter Widget Foreground Color
fg or foreground
: you can set the foreground color, which in this case is equivalent to the color of the label.
bg or background
: can set the background color.
The usage of bg has been illustrated with examples in Tkinter window properties, the usage of fg The usage of fg is the same as that of bg, so the following will be directly illustrated with an example.
from tkinter import *
root = Tk()
root.title("apidemos.com")
label = Label(root,text="I like tkinter",
fg="red",bg="yellow")
label.pack() # Packaging and positioning components
# print(type(label)) # <class 'NoneType'>
root.mainloop()
Output: