<p>Grid接受参数<code>uniform</code>,它接受任意值。具有相同值的所有行(或所有列)都被视为“统一组”的一部分。这将强制行(或列)的大小与其权重成比例。在</p>
<p>如果一个帧中有两行,这两行的权重相同,并且都属于同一个统一组,则它们将分别占用50%的可用空间。在</p>
<p>你可以这样做:</p>
<pre><code>innerFrame.grid_rowconfigure(0, weight=1, uniform="x")
innerFrame.grid_rowconfigure(1, weight=1, uniform="x")
</code></pre>
<p>(同样,“x”是任意的;它可以是任意值,只要两行的值相同)</p>
<p>tk的官方文档(构建tkinter的基础)是这样描述的(参见<a href="http://tcl.tk/man/tcl8.5/TkCmd/grid.htm#M24" rel="noreferrer">http://tcl.tk/man/tcl8.5/TkCmd/grid.htm#M24</a>)</p>
<blockquote>
<p>The -uniform option, when a non-empty value is supplied, places the row in a uniform group with other rows that have the same value for -uniform. The space for rows belonging to a uniform group is allocated so that their sizes are always in strict proportion to their -weight values.</p>
</blockquote>
<p>。。。在</p>
<blockquote>
<p>When multiple rows or columns belong to a uniform group, the space allocated to them is always in proportion to their weights. (A weight of zero is considered to be 1.) In other words, a row or column configured with -weight 1 -uniform a will have exactly the same size as any other row or column configured with -weight 1 -uniform a. A row or column configured with -weight 2 -uniform b will be exactly twice as large as one that is configured with -weight 1 -uniform b.</p>
</blockquote>
<hr/>
<p>注意:<code>uniform</code>选项没有出现在tkinter文档中,但它是一个完全有效的选项。多年来,它一直是tk的一部分(tkinter是建立在这个基础上的)。在</p>