You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
669 B

import tkinter as tk
def allumer():
canvas.itemconfig(ampoule_cercle, fill="yellow")
def eteindre():
canvas.itemconfig(ampoule_cercle, fill="black")
fenetre = tk.Tk()
fenetre.title("Ampoule")
canvas = tk.Canvas(fenetre, width=400, height=400, bg="black")
canvas.pack()
ampoule_cercle = canvas.create_oval(150, 100, 250, 200, outline="white", fill="black")
canvas.create_rectangle(190, 200, 210, 300, fill="white", outline="white")
btn_allumer = tk.Button(fenetre, text="Allumer", command=allumer)
btn_allumer.pack(side="left", padx=20)
btn_eteindre = tk.Button(fenetre, text="Éteindre", command=eteindre)
btn_eteindre.pack(side="right", padx=20)