Bonjour à tous

Je cherche comment mettre un délai entre la modification de 2 cercles dans un canevas

A l'origine j'utilisais un "time.sleep" est ce que le code suivant est plus "propre"

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
from tkinter import *
import time
 
window = Tk()
window.geometry("480x360")
can1 = Canvas(window, bg='dark grey', height=330, width=440)
can1.pack(expand="YES")
 
ampoule1 = can1.create_oval(30, 30, 90, 90, width=4, fill='grey')
ampoule2 = can1.create_oval(30, 110, 90, 170, width=4, fill='grey')
 
can1.update()
can1.after(1000)
can1.itemconfigure(ampoule1, fill='red')
can1.update()
can1.after(1000)
can1.itemconfigure(ampoule2, fill='red')
can1.update()
 
window.mainloop()