|
|
|
@ -1,10 +1,12 @@ |
|
|
|
import tkinter as tk |
|
|
|
|
|
|
|
def allumer (): |
|
|
|
canva.create_image(250/2,250/2, image=img) |
|
|
|
canva.itemconfigure(rond, fill='yellow') |
|
|
|
canva.itemconfigure(rectangle,fill='black') |
|
|
|
canva['bg']='white' |
|
|
|
|
|
|
|
|
|
|
|
def eteindre (): |
|
|
|
canva.itemconfigure(rond,fill='black',outline='white') |
|
|
|
canva.itemconfigure(rectangle,fill='white') |
|
|
|
@ -13,6 +15,7 @@ fenetre = tk.Tk() |
|
|
|
fenetre.title('lampe') |
|
|
|
canva=tk.Canvas(fenetre, width=500, height=500, bg='black') |
|
|
|
canva.grid(column=1, columnspan=2) |
|
|
|
img =tk.PhotoImage(file='chambre.png') |
|
|
|
rectangle =canva.create_rectangle(230,300,280,380, fill='white') |
|
|
|
rond = canva.create_oval(310,130,200,300,outline='white') |
|
|
|
tk.Button(text ='allumer',command=allumer).grid(column=1,row=3, padx=5,pady=5) |
|
|
|
|