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版 - 視窗
您是否知道'@'會將數字視爲像素? –
我不知道'@'做了什麼。抱歉。但我發現了一個解決方案來獲取使用變量的索引,請參閱下面的答案。 –