How do I change button size in Python Tkinter?

TkinterPythonServer Side ProgrammingProgramming

Tkinter Button widgets are used to create buttons that are necessary for an application. We can also add an event Object in the Button constructor and trigger it to perform some operation.

In order to customize the Button size, we can use the width and height property of the button widget.


In this example, we will create some buttons with different sizes,

#Import the required libraries
from tkinter import *

#Create an instance of tkinter frame
win= Tk()

#Set the geometry of frame

win.resizable(False, False)

Button(win, text="Button-1",height= 5, width=10).pack()
Button(win, text="Button-2",height=8, width=15).pack()
Button(win, text= "Button-3",height=10, width=30).pack()



Running the above code will display a window containing buttons of different sizes.

Updated on 27-Mar-2021 06:19:35