I asked a similar question about two years ago when I was trying to emulate LEDs on a Tkinter canvas. The solution then was to use the canvas after() method instead of the sleep() function to introduce a delay between widget updates.
Since then, I have discovered the tk_tools module which has a buit-in function to create LEDs, great! But I now have the same issue as before, which is: How to have a 1-second delay between the turning on (change to green) of each LED?
What actually happens when running the code below is that the LEDs are displayed in their OFF state (gray), then when I click the 'Start' button, there's a 4-second delay after which all LEDs turn on simultaneously.
Thank you. Johnnym
# LED array simulation
from tkinter import *
import tk_tools as tkt
from time import *
# turn on LEDs (change to green) with a 1-second delay between each
def turn_on():
for led in range(4):
led_array[led].to_green()
sleep(1)
# list to hold a 4-LED array
led_array = []
# GUI
root = Tk()
# create 4 LED widgets, store them in led_array[], display them
for i in range(4):
led_array.append(tkt.Led(root, size=30))
led_array[i].grid(row=0, column=i)
# create button to initiate LED turn-on sequence
start = Button(root, text='Start', padx=20, command=turn_on)
start.grid(row=1, columnspan=4)
root.mainloop()