1

I get this strange behaviour of the second frame. How do I resize the "Clone Repo" and "Pull" Buttons to the full column size? A picture of the output:

example

source:

from Tkinter import *

root = Frame()
root.grid(sticky=N+S+E+W)

local=LabelFrame(root, text="local")
local.grid(row=0, sticky=E+W)
external=LabelFrame(root, text="external")
external.grid(row=1, sticky=E+W)

StatusButton=Button(local, text="status")
StatusButton.grid(row=0, columnspan=2, sticky=W+E)

AddFileEntry=Entry(local)
AddFileEntry.grid(row=1, column=0)

AddFileButton=Button(local, text="add changed/new file(s)")
AddFileButton.grid(row=1, column=1, sticky=W+E)

CommitEntry=Entry(local)
CommitEntry.grid(row=2, column=0)

CommitButton=Button(local, text="Comment on changes")
CommitButton.grid(row=2, column=1, sticky=W+E)

CloneRepoEntry=Entry(external)
CloneRepoEntry.grid(row=0, column=0)

CommitRepoButton=Button(external, text="Clone repo")
CommitRepoButton.grid(row=0, column=1, sticky=W+E)

PushButton=Button(external, text="Push")
PushButton.grid(row=1, column=0, sticky=W+E)

PullButton=Button(external, text="Pull")
PullButton.grid(row=1, column=1, sticky=W+E)

root.mainloop()

1 Answer 1

2

The natural size of the widgets in the bottom frame are smaller than the frame. Tkinter needs to know how/where to allocate the extra space. You can tell it this information by giving a columm and/or row "weight".

In your case, giving column 1 of external a weight of 1 will cause it to expand to fill the empty space in the frame.

external.grid_columnconfigure(1, weight=1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.