mini projet
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.

31 lines
844 B

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')
canva['bg']='black'
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)
tk.Button(text ='eteindre',command=eteindre).grid(column=2,row=3, padx=5,pady=5)
fenetre.mainloop()