Python tkinter single label with bold and normal text

依然范特西╮ 提交于 2019-11-29 15:20:51

No, you cannot change the attributes of only some of the characters in a Label widget. If you need to style individual character you need to use a small Text widget.

For example:

text = tk.Text(root, height=1, font="Helvetica 12")
text.tag_configure("bold", font="Helvetica 12 bold")

text.insert("end", "Hello, ") 
text.insert("end", "world", "bold") 
text.configure(state="disabled")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!