[英]Tags Incorporated in String in Tkinter Text Widget
Tkinter Text
小部件允許使用標簽設置文本樣式。
text.tag_config('red', foreground='red')
text.insert(END, 'Red text', 'red')
是否可以在字符串文字中包含標簽?
偽代碼:
text.insert(END, 'This sentence has <red tag>red text</red tag> in it.')
不,不可能。 但是,編寫代碼來搜索文本小部件中的模式並將其替換為tkinter標簽非常容易。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.