- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I change button size in Python Tkinter?
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.geometry("600x250") 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() win.mainloop()
Running the above code will display a window containing buttons of different sizes.
- Python Tkinter – How do I change the text size in a label widget?
- How do I set a minimum window size in Tkinter?
- Change command Method for Tkinter Button in Python
- How do I change the background of a Frame in Tkinter?
- How do I change the font size of ticks of matplotlib.pyplot.colorbar.ColorbarBase?
- How do I change the overall theme of a tkinter application?
- How do I change the Tkinter default title in the OS bar?
- How do I find out the size of a canvas item in Tkinter?
- How to change Tkinter label text on button press?
- How do I make a pop-up in Tkinter when a button is clicked?
- How do I change the font size of the scale in Matplotlib plots?
- How to change the color of ttk button in Tkinter?
- How do I create child windows with Python tkinter?
- How do I display tooltips in Tkinter?
- How to change Tkinter Button state from disabled to normal?