title: I need to update some Label Text from outside of the function that created it
body: <p>I have a tkinter.Label created inside a function and from a totally seperate part of my code I need to update the text.</p>
  
  <p>I have tried just about every solution google provides over the last hour and I can't get any of them to work, some error, some show blanks, some just fail to do anything.</p>
  
  <p>I am creating the labels as follows</p>
  
  <pre><code>def createWindow():
      window = tkinter.Tk()
      container = tkinter.Frame(window, padx=5, pady=5)
      summaryFrame = tkinter.Frame(container, bd=2, relief='groove')
      summaryFrame.pack(side='top', fill='x')
      summaryUser = tkinter.Label(summaryFrame, text='Some text').grid(row=1, column=1, sticky='w')
  </code></pre>
  
  <p>Much later I need to change the text of this label but because I'm no longer in this createWindow() function I don't have access to the summaryUser variable that contains the text.</p>
  
  <p>I have tried summaryEvent["text"] (errors because it's not available), I have tried using a global variable and using textvariable=AGlobalVariable instead of text='Some text' (leaves the label text blank) and many other google results all with no success.</p>
  
  <p>This seems like the sort of functionality that should be easier than this...</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I have tried the following...</p>
  
  <pre><code>summaryUserText = 'Some text'
  
  def createWindow():
      global summaryUserText
      window = tkinter.Tk()
      container = tkinter.Frame(window, padx=5, pady=5)
      summaryFrame = tkinter.Frame(container, bd=2, relief='groove')
      summaryFrame.pack(side='top', fill='x')
      summaryUser = tkinter.Label(summaryFrame, textvariable=summaryUserText)
      summaryUser.grid(row=1, column=1, sticky='w')
  </code></pre>
  
  <p>When I try this the label just starts blank, not with the content of the variable.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I have also tried the following...</p>
  
  <pre><code>summaryUserText= tkinter.StringVar()
  summaryUserText.set('Some text')
  
  def createWindow():
      ...
      summaryUser= tkinter.Label(summaryFrame, textvariable=summaryUserText)
  </code></pre>
  
  <p>But as soon as python sees the first line it errors with the following...</p>
  
  <pre><code>  File "C:\Program Files\Python37\lib\tkinter\__init__.py", line 480, in __init__
      Variable.__init__(self, master, value, name)
    File "C:\Program Files\Python37\lib\tkinter\__init__.py", line 317, in __init__
      self._root = master._root()
  AttributeError: 'NoneType' object has no attribute '_root'
  </code></pre>
  
  <p><strong>Edit 3</strong></p>
  
  <p>The simplest code that simulates the issue in one complete file</p>
  
  <pre><code>import tkinter
  
  def loadEvent():
      global summaryEventText
      summaryEventText.set('Updated')
      print('Updated')
  
  def createWindow():
      global  summaryEventText
      window = tkinter.Tk()
      summaryEventText = tkinter.StringVar()
      summaryEventText.set('Init')
      summaryEventLabel = tkinter.Label(window, text='Event:').grid(row=0, column=0, sticky='e')
      summaryEvent = tkinter.Label(window, textvariable=summaryEventText).grid(row=0, column=1, sticky='w')
      window.mainloop()
  
  createWindow()
  loadEvent()
  </code></pre>
  
  <p>No errors, the print('Updated') works but the summaryEventText.set('Updated') does nothing.</p>