How can I exchange text fonts on buttons and text in guizero?

1.1k views Asked by At

I Try to use some fonts in Buttons and Text on Python Guizero. But it show always the same font. All the fonts are installed in my Linux system but the guizero do not show them.

Anyone know how can I use other fonts from the system? I need to install in my env? How can I do it?

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()
 
1

There are 1 answers

3
PurpleLlama On

You can use config. You can use tk.config with most if not all widgets to add a lot of different styling.

button.tk.config(font=("Verdana", 31))