Python tkinter grid layout problems
In my opinion, this is layout can be much easier with the pack geometry manager. One of the problems is that you are trying to make the width and the height of each widget fit in its place with rowspan
and columspan
options. Also, since canvas
is inside a frame, you have to think that it is like inside a new window, so a simple call to canvas.grid()
would be enough.
However, with pack()
you just have to put textbox
, run_button
and clear_button
inside a new frame:
left_frame = Frame(root)textbox = Text(left_frame, ...)run_button = Button(left_frame, ...)clear_button = Button(left_frame, ...)canvas_frame= Frame(root, ...)canvas_frame.configure(borderwidth=1.5,background='black')canvas = Canvas(canvas_frame, ...)console = Text(root, ...)left_frame.pack(side=LEFT)textbox.pack()run_button.pack(side=LEFT)clear_button.pack()canvas_frame.pack()canvas.pack()console.pack()