问题
I am teaching myself TKINTER at the moment. I have written...
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)
however the lower textBoxResults does not expand in the Y direction to fill the window as can be seen in this GUI picture. How can I make the textBoxResults expand in the Y direction, and keep the textBox and searchButton attached to the top please?
TIA
回答1:
This is a community-wiky answer, feel free to add related content!
Python Tutorial - 25.1.6.2. The Packer
Python Tutorial - 25.1.6.3. Packer Options
expand
Boolean, 0 or 1.fill
Legal values:'x'
,'y'
,'both'
,'none'
.
The Tkinter Pack Geometry Manager
The Pack geometry manager packs widgets in rows or columns. You can use options like fill, expand, and side to control this geometry manager.
来源:https://stackoverflow.com/questions/60931313/the-tkinter-pack-geometry-manager-options