【发布时间】:2020-07-10 20:48:24
【问题描述】:
我现在正在自学 TKINTER。我已经写了...
self.frameBottom = tk.Frame(master)
self.frameBottom.pack(side=tk.BOTTOM, fill=tk.BOTH)
self.textBox = tk.Text(master, height=1)
self.textBox.pack(side = tk.LEFT, expand=1, fill=tk.X)
self.searchButton = tk.Button(master, text="Search", command=self.searchButtonPress)
self.searchButton.pack(side = tk.RIGHT)
self.textBoxResults = tk.Text(self.frameBottom)
self.textBoxResults.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1)
但是,正如GUI picture 所示,下方的 textBoxResults 不会在 Y 方向扩展以填充窗口。请问如何使 textBoxResults 在 Y 方向展开,并保持 textBox 和 searchButton 附在顶部?
TIA
【问题讨论】:
-
将
expand=1添加到self.frameBottom.pack(...)。 -
感谢@acw1668,expand=1 成功了!
标签: python tkinter alignment tkinter-layout