有没有办法为 tkinter 标签中的文本部分着色?

问题描述

我想区分标签中的某些词。例如:

import tkinter as tk
root = tk.Tk()
lbl = tk.Label(root,text="hello world",fg="white")
lbl.pack()
#here I would like to color the word 'world' a different color

root.mainloop()

我知道在 Text 小部件中是可能的,就像他们在这里所做的那样:

example

(https://www.tutorialspoint.com/python/tk_text.htm)

但是我可以在标签小部件中进行吗?或者手动为颜色编码标签创建一个类?

解决方法

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

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

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