Tkinter Button width Option

Tkinter Button width option sets width of the button in letters (for textual buttons) or pixels (for images). You can give only integer values for width option, be it number of lines or pixels.

In this tutorial, we will learn how to use width option to change the width of Tkinter Button.

Example 1 – Tkinter Button set Width

In the following program, we will change the width of Tkinter Button.

example.py – Python Program

</>
Copy
import tkinter
import tkinter.font as font

window_main = tkinter.Tk(className='Tkinter - TutorialKart', )
window_main.geometry("400x200")

button_submit = tkinter.Button(window_main, text="Submit", width=15)
button_submit.pack()

button_login = tkinter.Button(window_main, text="Login", width=20)
button_login.pack()

window_main.mainloop()

Output

Tkinter Button Width

Conclusion

In this Python Tutorial, we learned about Tkinter Button width option and use it to change the width of a button, with the help of example Python programs.