7

Tell me the difference between pad-x/y and ipad-x/y. Are both same OR not

Kishan Sindhi
  • 73
  • 2
  • 6
  • 5
    **ipadx, ipady** − How many pixels to pad widget, horizontally and vertically, *inside* widget's borders. **padx, pady** − How many pixels to pad widget, horizontally and vertically, *outside* v's borders. –  Jun 07 '21 at 05:00
  • 2
    Or as I would like to remember, `ipadx` to be short for inner-padx – Delrius Euphoria Jun 07 '21 at 06:34

1 Answers1

9

ipadx, ipady − How many pixels to pad widget, horizontally and vertically, inside widget's borders. padx, pady − How many pixels to pad widget, horizontally and vertically, outside v's borders

Example: Here is ipadx. You can see the that the width has increased. It means that 20 pixels are there to the right and left of the Label. 20 pixels are padded horizontally. Similarly it is for ipady except it is vertical.

from tkinter import *

root=Tk()
Label(root,bg='light grey',text="Hello").grid(row=0,column=0,ipadx=20)
root.mainloop()

enter image description here

And here it is in case of padx. The widget is placed 20 pixels to the side, horizontally. Same is the case for pady except it is vertical.

from tkinter import *

root=Tk()
Label(root,bg='light grey',text="Hello").grid(row=0,column=0,padx=20)
root.mainloop()

enter image description here