'Python Tkinter color not working, it is the same whether I change the customization with canvas

I apologize in advance for any ignorant mistakes I make, I am still a beginner.

I recently started using tkinter on python, and while I tried using the backround customization in tkinter, It does not change any colors in the backround, the same goes with the frame. below is the code I have written.

import tkinter
import tkinter as tk

class GUI:
    root = tkinter.Tk()
    canvas = tk.Canvas(
        height=700,
        width=700,
        bg="#263D42"
    )
    canvas.config(bg="green")
    canvas.pack()
    root.mainloop()

    frame = tk.Frame(root, bg="white")
    frame.place(relheight=0.8, relwidth=0.8)

I am using M1 MacOS if that information helps, here is a screenshot of the GUI, it is the same when I comment out the color customization in the code. Here is the screenshot of the GUI



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source