title: Python: TKinter can't invoke "frame" command: application has been destroyed
body: <p>I'm trying to put in place a UI comprised of 4 frames, that depend of a main window. In each frame, there will be a button. Each frame has a title/label that must appear.</p>
  
  <p>There is an image background on the window, and I'm aiming to code so that the frames background are transparent (or black. This is not crucial).</p>
  
  <p>My problem is that, although the mainWindow appears smoothly, the program does not seem to manage to create the frames. I have no error before running, but one after closing it.</p>
  
  <p>I have read many different answers about the fact that the master has to be made available to my labels or such (and as far as I can understand, it is).</p>
  
  <pre><code>    from tkinter import *
      top = Tk()
  
      mainWindow = Canvas(top, bg = "blue", height = 500, width = 600)
      filename = PhotoImage(file="C:\matrix.png")
      background_label = Label(top, image=filename)
      background_label.place(x=0, y=0, relwidth=1, relheight=1)
  
      mainWindow.pack()
      top.mainloop()
  
  
      # fenêtre load Key
      KeyFrame = Frame(mainWindow, borderwidth = 2, relief = SUNKEN)
      KeyFrame.pack(side = LEFT, padx = 30, pady = 30)
  
      # fenêtre load Fichier
      FileFrame = Frame(mainWindow, borderwidth = 2, relief = SUNKEN)
      FileFrame.pack(side = RIGHT, padx = 10, pady = 10)
  
      # Labels
      KeyLabel = Label(KeyFrame, text = "Choix de la matrice...",  bg = "black").pack(fill = BOTH, expand = "YES")
      FileLabel = Label(FileFrame, text = "Choix de la fichier...", bg = "black").pack(fill = BOTH, expand = "YES")
  </code></pre>
  
  <p>Here is the error I can see when I close the program:</p>
  
  <pre><code>Traceback (most recent call last):
    File "PATH", line 15, in &lt;module&gt;
      KeyFrame = Frame(mainWindow, borderwidth = 2, relief = SUNKEN)
  
    File "PATH", line 2738, in __init__
      Widget.__init__(self, master, 'frame', cnf, {}, extra)
  
    File "PATH", line 2293, in __init__
      (widgetName, self._w) + extra + self._options(cnf))
  
  _tkinter.TclError: can't invoke "frame" command: application has been destroyed
  </code></pre>