itemmaintit = Label(addedFrame1.inner, anchor="w", text=tit0.value, width=95, height=2, font=('HCR Batang', 16), background="blue", border=0)
itemmaintit.config(cursor='arrow')
itemmaintit.pack(pady=(0,20))
itemmaintit[0:9] = Label(fg="red")如果itemmaintit[0:9]是"abcdeeffg“如何应用填充颜色?上面的代码是我的实践。
test = itemmaintit[0:9]
test.config(fg="blue")也失败了。
发布于 2021-07-13 22:11:10
标签只能有一种背景色和一种前景色。如果要为单个字符着色,则需要将多个标签连接在一起,或者使用更适合为单个字符着色的小部件,如Text小部件。
https://stackoverflow.com/questions/68362454
复制相似问题