Browse Source

petit soucis d'image

```

```
master
RAVET Célya 1 month ago
parent
commit
65a85f8cef
  1. 3
      projet_tkinter.py

3
projet_tkinter.py

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

Loading…
Cancel
Save