Hi I was just experimenting with some code, I am trying to change the color of text inside a label(like the rgb color effect in physical keyboards), with the following code I did get the color to change, but what I am trying to achieve is getting the colors of each letter of the text to change, but I have no idea how to do that.
below is the code I have written :
import tkinter as tk
import time
import random
color_list = ["red","blue","green","cyan1","yellow","purple"]
root = tk.Tk()
root.geometry("800x600")
i=0
txt = "Hello world"
l1 = tk.Label(root, text=txt)
l1.pack(pady=10)
def text():
#global i
global l1
global root
global color_list
global txt
try:
while True:
#for j in range(0,len(txt)):
random_value = random.randint(0,5)
l1.config(fg=f"{color_list[random_value]}")
l1.update()
time.sleep(1)
'''if i == 100:
l1.config(text="Process completed")
time.sleep(5)
root.destroy()'''
print()
except:
print("Program Exited")
root.after(3000, lambda: text())
root.mainloop()