title: Class for custom GUI element not showing
body: <p>I am trying to create a GUI as shown in figure below: </p>
  
  <p><a href="https://i.stack.imgur.com/BCuUw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BCuUw.png" alt="enter image description here"></a></p>
  
  <p>Following is the code: </p>
  
  <pre><code>#! /usr/bin/python3
  
  import tkinter as tk
  
  # CLASS FOR OWN PANEL: 
  class Mypanel(tk.Tk):
      def __init__(self):
          tk.Tk.__init__(self)
          self.label = tk.Label(self, text="Enter here:")
          self.entry = tk.Entry(self)
          self.label.pack()
          self.entry.pack()
  
  # FN FOR BUTTON:
  def adder():
      main_label.set((panel1.entry.get() + panel2.entry.get()))
  
  # CREATE GUI ELEMENTS: 
  main_window = tk.Tk()       # CREATE MAIN WINDOW
  panel1 = Mypanel()          # CREATE A PANEL
  panel2 = Mypanel()          # CREATE ANOTHER PANEL
  main_label = tk.Label(main_window, text="Press button to get values.")  
  main_button = tk.Button(main_window, text="Get values.", command=adder) 
  
  # PACK ALL GUI ELEMENTS IN main WINDOW
  panel1.pack()
  panel2.pack()
  main_label.pack()
  main_button.pack()
  
  # SHOW MAIN WINDOW: 
  main_window.mainloop()
  </code></pre>
  
  <p>However, it is giving following error: </p>
  
  <pre><code>$ ./guipanels.py
  Traceback (most recent call last):
    File "./guipanels.py", line 29, in &lt;module&gt;
      panel1.pack()
    File "/usr/lib/python3.5/tkinter/__init__.py", line 1961, in __getattr__
      return getattr(self.tk, attr)
  AttributeError: '_tkinter.tkapp' object has no attribute 'pack'
  </code></pre>
  
  <p>Where is the problem and how can it be solved? Thanks for your help.</p>