- 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 to add space between two widgets placed in a grid in tkinter?
Let us assume that we are creating a tkinter application where two or more widgets are placed using a grid property. We have to add some space between the widgets in order to style their appearance. To provide space in the widgets, we can use padding property, as padding adds space to the outermost part of the widget. In order to add padding, assign the values to padx and pady.
#Import the required library from tkinter import * #create an instance of tkinter frame win= Tk() win.geometry("750x250") #Create some Button widgets Label(win, text= "New Line Text", font= ('Helvetica 20 bold')).grid(row=0, column=5, padx= 25, pady= 25) Button(win, text= "Button 1").grid(row=0, column=1, padx= 50, pady= 80) Button(win, text= "Button 2").grid(row=0, column=2, padx= 25, pady =36) win.mainloop()
- How to delete Tkinter widgets from a window?
- How to show and hide widgets in Tkinter?
- Difference between .pack and .configure for widgets in Tkinter
- How to create transparent widgets using Tkinter?
- Showing and Hiding widgets in Tkinter?
- Adding a scrollbar to a group of widgets in Tkinter
- How to capture events on Tkinter child widgets?
- How to switch between two frames in Tkinter?
- How do you overlap widgets/frames in Python tkinter?
- Set how auto-placed items are inserted in the CSS grid
- Remove space between two words in MySQL?
- How to horizontally center a widget using a grid() in Tkinter?
- How to set the border color of certain Tkinter widgets?
- What is the difference between the widgets of tkinter and tkinter.ttk in Python?