0

I am trying to make a basic code editor in tkinter/python. And i want to add syntax highlighting for the text editor, but i cant find any resources that explain clearly how to add syntax highlighting for a tkinter textbox..

Source code

from tkinter import *
from tkinter import messagebox
#from pygments import *

# Window
root = Tk()
root.title("BasicText - None")
root.geometry("1000x400")
root.config(bg='#333333')

# Variables
FONT = 14

# Textbox
text = Text(root, bg="#333333", font=("Helvetica", FONT), fg='white', bd=0)
text.config(selectbackground='#333333', selectforeground='lightblue', insertbackground='white')

# Execute
if __name__ == '__main__':
    text.pack(expand=1, fill='both', pady=5, padx=5)
    root.mainloop()
  • A few other posts about the subject: https://stackoverflow.com/questions/29688831/pygments-syntax-highlighter-in-python-tkinter-text-widget, https://stackoverflow.com/questions/65192363/markdown-text-highlighting-performance-issues-tkinter/65200005#65200005, https://stackoverflow.com/questions/66183536/how-to-add-syntax-highlighting-to-text-in-tkinter/ – j_4321 Jun 04 '21 at 07:41
  • @j_4321 Alight, thanks alot :) – Windows blackscreen of death Jun 04 '21 at 08:54

0 Answers0