title: How can I modify a variable being used in one class from another class by using tkinter?
body: <p>What I'm trying to accomplish is a way of changing a variable in another class instance. I've been scratching my head trying to understand how (or if) this is possible.</p>
  
  <blockquote>
    <p>How can one update the value of <code>self.lblvar</code> that is in the class
    <code>MainWindow</code> from the class <code>SecondWindow</code>?</p>
  </blockquote>
  
  <p>This is what I'm working with to test my theory:</p>
  
  <pre><code>from tkinter import *
  
  class MainWindow:
      def __init__(self, rootWin):
          self.rootWin = rootWin
          self.rootWin.geometry('400x200')
  
          self.mainMenu = Menu(self.rootWin)
          self.mainMenu.add_command(label = 'Open Second Window', command = self.openSecondWindow)
  
          self.lblvar = StringVar()
          self.lblvar.set('Change Me!')
          self.lbl = Label(rootWin, textvariable = self.lblvar)
          self.lbl.pack()
  
          self.rootWin.config(menu = self.mainMenu)
  
      def openSecondWindow(self):
          self.secondWin = Tk()
          self.secWin = SecondWindow(self)
          self.secondWin.mainloop()
  
  class SecondWindow:
      def __init__(self, parent):
          self.parent = parent
  
          self.btn = Button(self, label = 'Change Label?', command = self.changeOther)
          self.btn.pack()
  
      def changeOther(self):
          self.parent.lblvar.set('Changed it!')
  
  def main():
      root = Tk()
      mainWin = MainWindow(root)
      root.mainloop()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>I'm a bit of a novice when it comes to Python classes, so any guidance and/or explanation regarding this would be appreciated!</p>
  
  <p><em>Edit: Changed original question to a clearer question to aid further searches on the topic</em></p>