commit
94f0a83119
1 changed files with 25 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||
|
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() |
Loading…
Reference in new issue