I have this simple tkinter code:
from tkinter import *
listofwordstodisplay = ['apple', 'banana', 'kiwi', 'pear']
def word(idx):
return listofwordstodisplay[idx]
root=Tk()
root.geometry("400x200")
root.configure(bg='white')
label=Label(root)
label.pack(anchor=CENTER, expand=TRUE)
label.configure(text=word(2))
sleep(2)
label.configure(text=word(3))
root.mainloop()
It only shows word(3) which is 'pear'. How can I make it show word(2), wait 2 seconds, then show word(3)?