<p><a href="http://effbot.org/tkinterbook/pack.htm" rel="nofollow noreferrer">From a website I found</a>:</p>
<blockquote>
<p><strong>side</strong>= Specifies which side to pack the widget against. To pack widgets
vertically, use TOP (default). To pack widgets horizontally, use LEFT.
You can also pack widgets along the BOTTOM and RIGHT edges. <strong>You can
mix sides in a single geometry manager, but the results may not always
be what you expect.</strong> While you can create pretty complicated layouts by
nesting Frame widgets, you may prefer using the grid geometry manager
for non-trivial layouts.</p>
</blockquote>
<p>所以对于你的代码,我会尝试:</p>
<pre><code>date.pack(side=TOP, fill=BOTH)
clock.pack(side=TOP, fill=BOTH)
</code></pre>
<p>即使您将<code>TOP</code>用于两者,它们也会按照您放置它们的顺序堆叠,因此<code>date</code>会放在日期的顶部,然后<code>clock</code>会放在日期的底部。你知道吗</p>
<p>编辑:另一个例子可以找到<a href="http://www.java2s.com/Code/Python/GUI-Tk/LayoutsideTOPLEFT.htm" rel="nofollow noreferrer">here</a></p>
<hr/>
<p>我认为你现在的问题是使用多帧。试试这个:</p>
<pre><code>fm = Frame(root)
data = Label(fm, font=('ariel', 20, 'bold'), bg='black', fg='white')
clock = Label(fm, font=('ariel', 20, 'bold'), bg='black', fg='white')
date.pack(side=TOP, fill=BOTH)
clock.pack(side=TOP, fill=BOTH)
</code></pre>