tkinter中的多字节字符

时间:2016-02-09 10:43:25

标签: python tkinter tcl tk tkinter-canvas

我试图在tkinter中突出显示从位置10到位置15的字符。问题是某些字符是多字节的,而在gui中它不会遮挡从字符10到字符15的位置,而是显示字符的字节因此,在gui中,以下着色在位置10之前开始并在位置15之前结束

textPad.mark_set("matchstart", textPad.index("0.0 + 10 chars"))
textPad.mark_set("matchend", textPad.index("0.0 + 15 chars"))
textPad.tag_add(highlightType, "matchstart", "matchend")

我该如何解决这个问题?

0 个答案:

没有答案
相关问题