How to change font and size of buttons in Tkinter Python
In this tutorial, we are going to see how to change the font and size of buttons in Tkinter Python. You can change the font and size of the Tkinter buttons, using the tkinter.font package. In your Python program, import tkinter.font, create the font.Font() object with the required options and assign the Font object to the ‘font’ option of the Button.
Example 1: Changing the font family of the tkinter button
In this example, we will change the font family of the tkinter button using the parameter called “family” given to font.Font().
from tkinter import * import tkinter.font as font gui = Tk() gui.geometry("300x200") # set the font. f = font.Font(family='Times New Roman') # create button btn = Button(gui, text='Click here!', bg='red', fg='white') # apply font to the button label btn['font'] = f # add button to window btn.pack() gui.mainloop()
Output:

Example 2: Changing the font size of the tkinter button
You can also change the font size of the text in the tkinter button, by passing the size to font.Font() method.
In this example, we will change the font size of the tkinter button.
from tkinter import * import tkinter.font as font gui = Tk() gui.geometry("300x200") # set the font f = font.Font(size=35) # create button btn = Button(gui, text='Click here!', bg='red', fg='white') # apply font to button label btn['font'] = f # add button to window btn.pack() gui.mainloop()
Output:

Example 3: Bold the font of tkinter button
You can also make the text font bold in tkinter button, by passing the value ‘bold’ to the argument named “weight” to font.Font().
In this example, we will bold the font of the tkinter button.
from tkinter import * import tkinter.font as font gui = Tk() gui.geometry("300x200") # set the font with bold text f = font.Font(weight="bold") # create button btn = Button(gui, text='Click here!', bg='red', fg='white') # apply font to button label btn['font'] = f # add button to window btn.pack() gui.mainloop()
Output:

Complete Example:
We can apply any font style with font.Font().
from tkinter import * import tkinter.font as font gui = Tk() gui.geometry("300x200") # set the font f = font.Font(family='Times New Roman', size=35, weight="bold") # create button btn = Button(gui, text='Click here!', bg='red', fg='white') # apply font to button label btn['font'] = f # add button to window btn.pack() gui.mainloop()
Output:
