title: Understanding parent and controller in Tkinter __init__
body: <p>I want to understand what the below code means:</p>
  
  <pre><code>class PageOne(tk.Frame):
  
      def __init__(self, parent, controller):
  </code></pre>
  
  <p>What are <code>self</code>, <code>parent</code> and <code>controller</code>? What is the role and scope of these tools here?</p>
  
  <p>I believe <code>self</code> is similar to <code>this</code> in Java, but what's the use of <code>parent</code> and <code>controller</code>?</p>
  
  <p>Later in the code flow I can see:</p>
  
  <pre><code>button1 = tk.Button(self, text="Back to Home",
        command=lambda: controller.show_frame(StartPage))
  </code></pre>
  
  <p>There is a function already defined called <code>show_frame</code>, but why is the controller being used to call this function?</p>