How to change the font and size of buttons and frame in tkinter?

Tkinter Button Widgets are a general way to provide Event Handling in a variety of applications. Sometimes, we may need to style the buttons which are defined in an application. In order to add styling in the button widgets, first create an instance of Button widget using a variable. Then, add some property like fontfamily, font-size, padding, etc. into it. The most general way to resize the button is by resizing the text in it.


In this example, we have created a button that can be resized by changing the value in the 'font' property.

#Import tkinter library
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the Geometry
def click_to_close():
#Create a Button
button= Button(win, text= "Click to Close", font= ('Helvetica 20
bold italic'), command=click_to_close)


Running the given code will generate a button with some text in it which can be resized by changing the value of the font-size.