title: Update Text Widget of a window from another window
body: <p>I am creating an tkinter application, and wish to add a new window to that app, where I can update the status of current operation. My intention is, every time, when an event is complete, I want to update that to a text widget of a separate window which runs in parallel. Similar to a console window, easy for users to read and understand the status of application/errors etc.</p>
  
  <p>I am fairly new to python and Tkinter, my approach is as follows,</p>
  
  <p>Before directly including it in the actual application, i tried to replicate what I had in mind, in a separate project.</p>
  
  <p>First I have created a simple main Window as follows,</p>
  
  <pre><code>from tkinter import *
  from tkinter import ttk
  from Console import ConsoleWindow
  
  class Main:
  
      def __init__(self, master):
  
          self.master = master
          self.master.title('Main')
          self.master.geometry('640x480')
          self.btn = ttk.Button(self.master, text = 'Run Console', command = self.runConsole)
          self.btn.pack(side = LEFT)
          self.btn2 = ttk.Button(self.master, text = 'Update Console', command = self.updateConsole, state = DISABLED)
          self.btn2.pack(side = RIGHT)
  
      def runConsole(self):
  
          self.btn.configure(state = 'disabled')
          self.btn2.configure(state = 'normal')
          consolewindow = Toplevel(self.master)
          console = ConsoleWindow(consolewindow)
          consolewindow.mainloop()
  
  
      def updateConsole(self):
  
          string = 'Console Text !!'
          ConsoleWindow.insertText(string)
  
  def main():
  
      mainWindow = Tk()
      mainGUI = Main(mainWindow)
      mainWindow.mainloop()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>Next, a Console window</p>
  
  <pre><code>from tkinter import *
  
  class ConsoleWindow:
  
      def __init__(self, master):
  
          self.master = master
          self.master.title('Console Window')
          self.master.geometry('640x480')
          self.scrollBar = Scrollbar(self.master)
          self.textArea = Text(self.master)
          self.scrollBar.pack(side=RIGHT, fill=Y)
          self.textArea.pack(side=LEFT, fill=Y)
          self.scrollBar.config(command=self.textArea.yview)
          self.textArea.config(yscrollcommand=self.scrollBar.set)
          self.textArea.insert(INSERT, 'Running')
          self.textArea.configure(state='disabled')
  
      def insertText(self, textToUpdate):
  
          text = f'{textToUpdate}\n'
          self.textArea.configure(state='normal')
          self.textArea.insert(INSERT, text)
          self.textArea.configure(state='disabled')
  </code></pre>
  
  <p>What I expect to do is, to use the insertText function to update the Text Widget multiple times during the application runtime. When I run this code, I am able to create an instance of the ConsoleWindow, but when i press "update console" button, I get the following error.</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Users\Aswin Kumar\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
      return self.func(*args)
    File "C:/Users/Aswin Kumar/Console Window/Main.py", line 31, in updateConsole
      ConsoleWindow.insertText(string)
  TypeError: insertText() missing 1 required positional argument: 'textToUpdate'
  </code></pre>
  
  <p>I tried adding ,the instance of ConsoleWindow to the insertText(),</p>
  
  <pre><code>ConsoleWindow.insertText(console, string)
  </code></pre>
  
  <p>And Getting the following error,</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Users\Aswin Kumar\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
      return self.func(*args)
    File "C:/Users/Aswin Kumar/Console Window/Main.py", line 31, in updateConsole
      ConsoleWindow.insertText(console, string)
  NameError: name 'console' is not defined
  </code></pre>
  
  <p>How do I update the console window from my main window. Or is there any alternate approach which I can use for this case. </p>