I have a stack of Frames like this:
+--+
| |
+-+--+-+
| |
+-+------+-+
| |
+----------+
But I want them like this:
+--+
| |
+---+--+
| |
+---+------+
| |
+----------+
What is the best way to do this?
Was using pack and couldn’t get them to behave right. For some reason, using grid didn’t display them at all and my program hangs
# Main script
root = Tk()
root.geometry('500x500')
for task in TaskList:
GuiTools.TaskBox.TaskBox(root, task)
root.mainloop() # program hangs from this line, to the point of having to use kill to close it
# Taskbox class
class Taskbox(master, task):
__init__(self)
self.TaskFrame = Frame(master, borderwidth=3, relief=RAISED)
. . .
Putting stuff in frame
. . .
self.TaskFrame.pack() # Gives result 1
#self.TaskFrame.grid(column=1, sticky='ne') # no display, causes hang
This is a bit tricky to answer without knowing what you’re putting into the frames in the first place. @sc0tt is correct that you probably want to use
sticky=tk.E, however, that might not be good enough to get what you want since your frames will likely resize themselves depending on what you put in them (unless you domyframe.grid_propagate(False)). The solution to this is to put in thecolumnspankeyword as well.Here’s a stupid loop which will do something like what you want:
This effectively partitions your grid like this: