commit 94f0a8311925546ef5dde882793025c56eecc6cd Author: Loïc <> Date: Sat Apr 5 12:26:37 2025 +0200 projet tk diff --git a/mini_projet_tkinter.py b/mini_projet_tkinter.py new file mode 100644 index 0000000..3202e46 --- /dev/null +++ b/mini_projet_tkinter.py @@ -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() \ No newline at end of file