0

我尝试在 Python Guizero 的按钮和文本中使用一些字体。但它总是显示相同的字体。所有字体都安装在我的 Linux 系统中,但 guizero 没有显示它们。

有人知道如何使用系统中的其他字体吗?我需要安装在我的环境中吗?我该怎么做?

from guizero import App,Text,PushButton

def troca():
    message.font="arial"

if __name__ == '__main__':

    app = App(title="Run Pre BRAMS",layout="grid",height=500,width=300)
    message = Text(app, text="Just a test",font="Helvetica",color='blue',grid=[1,1])

    button = PushButton(app, troca, text="exchange", grid=[2,2])


    app.display()
 
4

1 回答 1

0

你可以使用配置。您可以将 tk.config 与大多数(如果不是全部)小部件一起使用,以添加许多不同的样式。

button.tk.config(font=("Verdana", 31))
于 2020-12-25T22:18:10.497 回答