title: Using classes as frames in Python Tkinter
body: <p>I'm currently working on a Python Tkinter code which is getting longer and longer. I wanted to implement using multiple classes for some of the frames in my GUI. </p>
  
  <p>Below code is a sample of what I am trying to do. Basically making a class which has a frame, and the frame is using another class as a parent. </p>
  
  <p>But when I run the code, I get this error "'MainProgram' object has no attribute 'FirstFrame'"</p>
  
  <p>Any solutions? I tried searching but I wasn't successful on finding something like this.</p>
  
  <pre><code>import tkinter as tk
  from tkinter import ttk
  
  class MainProgram():
      def __init__(self):
          self.mainwin = tk.Tk()
          self.FirstFrame()        
  
  
  class FirstFrame():
      def __init__(self):
          self.firstframe = ttk.LabelFrame(self.MainProgram.mainwin, text="hi")
          self.firstframe.grid(column=0, row=0)
  
  if __name__ == "__main__":
      main = MainProgram()
      main.mainwin.mainloop
  </code></pre>