1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| from tkinter import *
# Création de l'instance Tk
fen1 =Tk()
def foncChange():
# objLabel1.configure(bg = 'red')
# Ici le code que je ne trouve pas pour changer la couleur de objLabel1
pass
# Création fenêtre principale
varCoulPrinc = "Slate Gray"
fen1.geometry('350x100')
fen1.title("Codes")
# Création objets
objLabel1 = Label(fen1 ,height=1 ,width=30, text="Logging", bg=varCoulPrinc).grid(row=2, sticky=W, padx=5, pady=(5 ,0))
bouton = Button(fen1, text = "Chg couleur label", command=foncChange)
bouton.grid()
# Générateur événement
fen1.mainloop() |