0

This might be confusing but for some odd reason using ipadx or ipady in .pack() with (1,0) or like this: Label(root, text='Hello World').pack(ipadx=(1,0)) will always make this error: TclError: bad ipady value "1 0": must be positive screen distance. Trying other things like: Label(root, text='Hello World').pack(ipadx=1) work just fine. But This Said:

The padding options (padx, ipadx, pady and ipady) can take a 2-tuple that represent the left/right and top/bottom padding.

So, what is happening...

And here's some complete Code that has the error too:

from Tkinter import *

root = Tk()

Label(root, text='Hello World').pack(ipadx=(1, 0))

root.mainloop()

Update: I found that you can't do that in Tkinter, or even Tcl/Tk...

Community
  • 1
  • 1
user6322930
  • 23
  • 1
  • 5

1 Answers1

5

The answer you linked to is wrong, and I'll update it. ipadx and ipady do not support a tuple as an argument. From the official tcl/tk docs:

-ipadx amount

Amount specifies how much horizontal internal padding to leave on each side of the slave(s). Amount must be a valid screen distance, such as 2 or .5c. It defaults to 0.

-ipady amount

Amount specifies how much vertical internal padding to leave on each side of the slave(s). Amount defaults to 0.

-padx amount

Amount specifies how much horizontal external padding to leave on each side of the slave(s). Amount may be a list of two values to specify padding for left and right separately. Amount defaults to 0.

-pady amount

Amount specifies how much vertical external padding to leave on each side of the slave(s). Amount may be a list of two values to specify padding for top and bottom separately. Amount defaults to 0.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685