Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tkinter奇怪的帧大小_Python_Size_Tkinter_Frame - Fatal编程技术网

Python Tkinter奇怪的帧大小

Python Tkinter奇怪的帧大小,python,size,tkinter,frame,Python,Size,Tkinter,Frame,我得到了第二帧的这种奇怪的行为。如何将“克隆回购”和“拉动”按钮调整为整列大小?输出的图片: 资料来源: 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,

我得到了第二帧的这种奇怪的行为。如何将“克隆回购”和“拉动”按钮调整为整列大小?输出的图片:

资料来源:

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()

底部框架中小部件的自然大小小于框架。Tkinter需要知道如何/在何处分配额外空间。您可以通过给出列和/或行“重量”来告诉它此信息

在您的情况下,将
external
的第1列的权重设置为1将使其展开以填充帧中的空白

external.grid_columnconfigure(1, weight=1)