Tkinter Button height Option

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

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

Example 1 – Tkinter Button height

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

example.py – Python Program

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", height=3)
button_submit.pack()

button_login = tkinter.Button(window_main, text="Login", height=2)
button_login.pack()

window_main.mainloop()

Output

ADVERTISEMENT
Tkinter Button Height

Conclusion

In this Python Tutorial, we learned about Tkinter Button height option, with the help of example Python programs.