Aaron Grace
Aaron Grace

Reputation: 23

Can't use tkinter's config function to set pady to a tuple

So I want to reconfigure some of my rows to have a higher padding on the bottom but I can't seem to use the config function with a tuple.

This code below returns a _tkinter.TclError: bad screen distance "0 5".

    for k in [2,5,7]:
        self.accounts[k].config(pady = (0,5), bg = "yellow")
    #accounts is a list of frames

Upvotes: 0

Views: 121

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

Widgets don't accept a padding that is a tuple. The tuple is only supported as arguments to pack and grid. You'll need to specify the pady by calling grid_configure, assuming you're using grid.

for k in [2,5,7]:
    self.accounts[k].config(bg = "yellow")
    self.accounts[k].grid_configure(pady = (0,5))

Upvotes: 1

Related Questions