I am trying to make a tkinter app with a smaller side menù on the left, this is how it should look like:
from tkinter import *
root = Tk()
root.geometry("700x500")
root.grid_columnconfigure(0, weight = 1)
root.grid_columnconfigure(1, weight = 2)
root.grid_rowconfigure(0, weight = 1)
left_frame = Frame(root, background = "red")
left_frame.grid_rowconfigure(0, weight = 1)
left_frame.grid_columnconfigure(0, weight = 1)
left_frame.grid(row = 0, column = 0, sticky = "news")
right_frame = Frame(root, background = "blue")
right_frame.grid(row = 0, column = 1, sticky = "news")
root.mainloop()
The problem is, if I try to put a canvas inside the red frame, this happens:
from tkinter import *
root = Tk()
root.geometry("700x500")
root.grid_columnconfigure(0, weight = 1)
root.grid_columnconfigure(1, weight = 2)
root.grid_rowconfigure(0, weight = 1)
left_frame = Frame(root, background = "red")
left_frame.grid_rowconfigure(0, weight = 1)
left_frame.grid_columnconfigure(0, weight = 1)
left_frame.grid(row = 0, column = 0, sticky = "news")
right_frame = Frame(root, background = "blue")
right_frame.grid(row = 0, column = 1, sticky = "news")
c = Canvas(left_frame, borderwidth=0, background = "yellow", highlightthickness=0)
c.grid(row = 0, column = 0, sticky = "news")
root.mainloop()
I was expecting the yellow canvas to fill the red frame without changing its size, where did I go wrong? Thank you.