I am actually trying to make a python coding editor, for that I need to make a color-coding system. For example: 'def', 'or', 'if', 'elif', 'else', 'import' etc. should be in different colors as they are commands. Something like this:
from tkinter import *
import threading
def colorcommands():
while True:
a = textArea.get(0.0, END)
for f in ["def", "or", "and", "if", "import", "else"]:
textArea.replace(f, (f, fg="red"))
master = Tk()
textArea = Text()
textArea.pack()
threading.Thread(target=colorcommands).start()
master.mainloop()
But obviously this gives me an error, as there is no such command as this. Can anyone help me out?