title: How to communicate between classes in Python?
body: <p>I'm trying to build calculator based on tkinter. I also follow tips from <a href="https://codereview.stackexchange.com/questions/161569/gui-calculator-using-tkinter">there</a>.
  Program for sure is still in progress. I'm currently stuck because of this error:</p>
  
  <blockquote>
    <p>AttributeError: 'Calculator_GUI' object has no attribute 'main'</p>
  </blockquote>
  
  <p>I have no idea how to get to work communication between both classes. I'm also asking for short review of what already is done. Thanks in advance!
  Here's the code:</p>
  
  <pre><code>import tkinter as tk
  from tkinter import ttk
  
  class Calculator_Core():
      def __init__(self):
          self.input = tk.StringVar()
  
      def buttonClick(self, a):
          self.input.set(a)
          #DEBUG:
          print(self.input)
  
  
  class Calculator_GUI(tk.Frame):
      def __init__(self, master):
          tk.Frame.__init__(self, master)
          self.master = master
          self.button = {}
          self.configure_gui()
          self.create_widgets()
          self.main = Calculator_Core()
  
      def configure_gui(self):
          self.master.title("Calculator")
          self.master.resizable(False, False)
  
      def create_widgets(self):
          self.configure_input_space()
          row_number = 1
          column_number = 0
          a = -1
          text_buttons = ('789+', '456-', '123*', '0=/C')
          for button_row in text_buttons:
              for text_button in button_row:
                  a += 1
                  self.configure_button(text_button, row_number, column_number, a)
                  column_number += 1
              row_number += 1
              column_number = 0
  
      def configure_button(self, text, row, column, key):
          self.button[key] = ttk.Button(self.master, text=text,
                                    command=lambda: self.main.buttonClick(text))
          self.button[key].grid(row=row, column=column)
  
      def configure_input_space(self):
          self.entry = ttk.Entry(self.master, textvariable=self.main.input)
          self.entry.grid(columnspan=4, sticky='we')
  
  
  if __name__ == "__main__":
      root = tk.Tk()
      Calculator_GUI(root)
      root.mainloop()
  </code></pre>