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.
25 lines
925 B
25 lines
925 B
from tkinter import *
|
|
def allumer():
|
|
"""Fonction qui change la couleur du cercle en jaune pour que l'ampoule soit allumer . """
|
|
canvas.create_oval(100,40,400,340,outline='white',fill='yellow')
|
|
canvas.create_rectangle(150,300,350,420,fill='white')
|
|
def eteindre():
|
|
"""Fonction qui change la couleur du cercle en noir pour que l'ampoule soit eteinte . """
|
|
canvas.create_oval(100,40,400,340,outline='white',fill='black')
|
|
canvas.create_rectangle(150,300,350,420,fill='white')
|
|
fenetre = Tk()
|
|
|
|
|
|
canvas = Canvas(fenetre, width=500, height=500, background='black')
|
|
canvas.pack()
|
|
|
|
canvas.create_rectangle(150,300,350,420,fill='white')
|
|
canvas.create_oval(100,40,400,340,outline='white')
|
|
|
|
bouton_on = Button(fenetre, width = 10, height= 2,text ='Allumer',command=allumer)
|
|
bouton_off = Button(fenetre, width = 10, height= 2,text ='Eteindre',command=eteindre)
|
|
|
|
bouton_on.pack()
|
|
bouton_off.pack()
|
|
|
|
fenetre.mainloop()
|