Mudar de fundo de cor

from tkinter import *
root= Tk()
def preto():
root.config(background ='#000000')
def azul():
root.config(background ='#2986cc')
def dourado():
root.config(background ='#f1c232')
def verde():
root.config(background ='#6aa84f')
def vermelho():
root.config(background='#f44336')
def castanho():
root.config(background='#744700')
petrob= Button(root,text="Preto",command=preto).place(relx=0.05, rely=0.05)
azulb= Button(root,text="Azul",command=azul).place(relx=0.18, rely=0.05)
douradob = Button(root,text="Dourado",command=dourado).place(relx=0.3, rely=0.05)
verdeb = Button(root,text="Verde",command=verde).place(relx=0.48, rely=0.05)
vermelhob = Button(root,text="Vermelho",command=vermelho).place(relx=0.63, rely=0.05)
castanhob = Button(root,text="Castanho",command=castanho).place(relx=0.83, rely=0.05)
root.title('cor')
root.geometry("400x400")
root.resizable(False,False)
root.mainloop()

Comentários

Mensagens populares deste blogue

Criar Cartões de Visita

12 signos egípcios

Calcular a percentagem de ocupação