MikeVaughan
MikeVaughan

Reputation: 1501

Tkinter, seemingly random spacing?

I have the following code.

    Label(pop, text = "Timesheet does not exist.").grid(row = 0)

    Label(pop, text = "Create Time sheet?").grid(row = 2, column = 0)

    y = Button(pop, text = "Yes").grid(row = 3, column = 1)
    n = Button(pop, text = "No").grid(row = 3, column = 0)

There's an odd space before the second label.Screenshot

Anyone have an explanation/solution for this?

Upvotes: 0

Views: 136

Answers (1)

jsbueno
jsbueno

Reputation: 110166

There is nothing strange in there: the second button is in column 1, as you ordered it - while the other button, and the first two labels are on column 0. Column 1 should be to the left of column 0.

Use colspan=2 as options to the construction of the Label objects, so that the phrases use both columns, and your second button does not show to the right of both.

Otherwise, just use the pack layout manager instead of grid - since you don't seen to want a table like structure in small dialogs like this.

Upvotes: 4

Related Questions