I am making a text editor in python with a Syntax Highlighting feature.
I used pygment
module, but it is not highlighting my code rather printing plain html
code.
This is my code :
from tkinter import*
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
root=Tk()
code="hello "
formatter = HtmlFormatter()
css = formatter.get_style_defs()
div = highlight(code, PythonLexer(), formatter)
text=Text()
text.insert(INSERT,div)
text.pack()
root.mainloop()
I want that the highlighted code should be inserted in my Text widget
but plain HTML code is inserted.
Thanks :)