How to add space between two widgets placed in grid in tkinter ~ python?

前端 未结 1 1595
感动是毒
感动是毒 2020-12-14 07:51

a. Have placed a widget in the row 0 in the grid as shown below.

self.a_button = Button(root, text=\"A Button\")
self.a_button.grid(row=0, column=1)
<         


        
相关标签:
1条回答
  • 2020-12-14 08:30

    When you pack the widget you can use

    self.a_button = Button(root, text="A Button") 
    self.a_button.grid(row=0, column=1, padx=10, pady=10)
    

    Using padx and pady you can add padding to the outer side of the button and alternatively if you want to increase the size of the button you can add inner padding using ipadx and ipady.

    If you want more on the Grid function you can view all the options and uses here.

    0 讨论(0)
提交回复
热议问题