I'm designing a GUI to decrease the time which my colleagues spend for reporting tests. But I stuck in the animation of opening screen. I mixed the code that I found on the internet which writes the chosen text letter one by one with a second for loop to enlarge the text but the first loop worked only for the last word of the list. Also, I tried the same code with a while loop both with giving count or just writing "True" but they didn't solve my problem either.
I want to see the chosen texts (now, only a few words but later on I will write my tests) written on the screen one by one and letter by letter. How can I solve this?
My sketch code is as follows:
import tkinter as tk
import random
root = tk.Tk()
root.configure(bg="white")
Words=["Canvas", "Import", "Index", "Random", "Tkinter"]
canvas=tk.Canvas(root, width=400, height=375, bg="white")
canvas.pack()
for word in Words:
x=random.randint(0, 250)
y=random.randint(0, 225)
canvas_text=canvas.create_text(x, y, text=word)
delta=500
delay=0
for i in range(len(word)+1):
s=word[:i]
update_text=lambda s=s: canvas.itemconfigure(canvas_text, text=s)
canvas.after(delay, update_text)
delay+=delta
x=random.randint(0, 250)
y=random.randint(0, 225)
root.mainloop()