0
我想着色temp
变量,但没有运气:应用标签
from Tkinter import *
root = Tk()
text = Text(root)
temp='Hello'
text.insert(INSERT, "Hello %s" %temp)
text.pack()
x=1
y=10
text.tag_add("tag1", "1.4", "@%d,%d" %(x, y))
text.tag_config("tag1", background="blue", foreground="yellow")
root.mainloop()
而除了这样做,如果有任何的方式,有没有指定的方式指数使用变量x
和y
?我认为这可以解决我的问题。
Python 2.7版 - 视窗
您是否知道'@'会将数字视为像素? –
我不知道'@'做了什么。抱歉。但我发现了一个解决方案来获取使用变量的索引,请参阅下面的答案。 –