Como definir a cor do lençol de backgroud Tkinter
O método da classe widget Tkinter configure e o atributo bg ou backgroud podem ser utilizados para definir a cor de fundo do widget/janela Tkinter.
Método configure(background= )
    
try:
    import Tkinter as tk
except:
    import tkinter as tk
app = tk.Tk()
app.title("configure method")
app.geometry("300x200")
app.configure(bg="red")
app.mainloop()
Toma,
app.configure(bg='red') configura a cor de fundo do app para ser red. Você também poderia utilizar background ao invés de bg.
app.configure(background='red').

Atributo bg ou background
O background ou bg é um atributo na maioria dos Tkinter widgets, e pode ser utilizado para definir diretamente a cor de fundo.
try:
    import Tkinter as tk
except:
    import tkinter as tk
app = tk.Tk()
app.title("bg attribute")
app.geometry("300x200")
app["bg"] = "blue"
app.mainloop()

Código de cor Tkinter
Você poderia especificar a cor com os nomes conhecidos como red, blue ou green como mostrado acima, e você também poderia especificá-la via RGB como códigos de cores hexadecimais em HTML, por exemplo, #49A ou #0059b3.
try:
    import Tkinter as tk
except:
    import tkinter as tk
app = tk.Tk()
app.title("bg attribute")
app.geometry("300x200")
app["bg"] = "#0059b3"
app.mainloop()

try:
    import Tkinter as tk
except:
    import tkinter as tk
app = tk.Tk()
app.title("bg attribute")
app.geometry("300x200")
app["bg"] = "#49A"
app.mainloop()

Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.
LinkedIn Facebook