我们能否在串联中的tkinter小部件中使用变量之外定义两个文本字符串的字体?

问题描述 投票:0回答:1

我愿意做这种事情。

from tkinter import *

root=Tk()

t1="Visit Us:"
t2="www.something.com"

如果我可以分别配置t1和t2的字体描述符,那将很有帮助!

Button(root, text=t1+t2, command=Visit).pack()

root.mainloop()
python string button tkinter fonts
1个回答
0
投票

不,你不能做你想做的。对于字符串的不同部分,唯一支持不同字体的小部件是CanvasText小部件。

© www.soinside.com 2019 - 2024. All rights reserved.