
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Changing TTK Button Height in Python
Ttk adds styles to the tkinter’s standard widget which can be configured through different properties and functions. We can change the height of the ttk button by using the grid(options) method. This method contains various attributes and properties with some different options. If we want to resize the ttk button, we can specify the value of internal padding such as ipadx and ipady.
Example
Let us understand it with an example,
#Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkinter frame or window win = Tk() #Set the geometry of tkinter frame win.geometry("750x250") #Create a button using the ttk themed widget button = ttk.Button(win, text = "Button") button.grid(ipadx=10, ipady=30 ) win.mainloop()
Output
In the above code, we have added internal padding to the button widget. Now, run the program to display the output,
Advertisements