如何解决使用 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 举报,一经查实,本站将立刻删除。