je suis donc en train de plancher sur cette exercice.

J'utilise des boucle pour tracer mes différent éléments graphiques.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Programme principal
fen=tk.Tk()
can=tk.Canvas(fen,height=500,width=600,bg="white")
can.grid()
can.create_rectangle(200,10,400,490,fill='grey')
x=202
while x<400:
    id=can.create_rectangle(x,100,x+15,400,fill='yellow')
    x=x+30
 
 
a=0
while a<5:
    x,y=170,80
    while a<2:
        id=can.create_oval(x,y,x+20,y+20,fill="green")
        a=a+1
        x,y=x+240,y+320
 
 
    x,y=170,400
    while a>=2 and a<=5:
        id=can.create_oval(x,y,x+18,y+18,fill="red")
        x,y=x+240,y-320
        a=a+1
 
 
tk.Button(fen,text='Changer',command=Changer).grid(sticky=tk.E)
 
fen.mainloop()
Ma question est comment je peux interagir aprés coup sur les objets pour en changer des paramètres?
J'ai bien compris que python/Tkinter indente une ID pour chaque éléments, mais comment puis je utiliser cette idée pour atteindre l'objet que je veux. (par ex, changer la couleur du cercle ayant pour ID=13)?

merci d'avance......