使用 pygments 语法高亮 Tkinter 文本框

问题描述

我正在尝试在 tkinter/python 中制作一个基本的代码编辑器。我想为文本编辑器添加语法突出显示,但我找不到任何资源可以清楚地解释如何为 tkinter 文本框添加语法突出显示..

代码

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()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)