title: Updating variable values when running a thread using QThread in PyQt4
body: <p>So problem occurred when I tried using <code>Threading</code> in my code. What I want to do is passing default values to the <code>def __init__</code> and then calling the thread with its instance with updated values but somehow I cannot get the updated values.<br><br> Below is my initial code: <strong>main.py</strong></p>
  
  <pre><code>from PyQt4 import QtGui
  import sys
  import GUI # GUI app by using PYQT4
  from PyQt4.QtCore import QThread
  #import Photos
  
  class PyMain(QtGui.QWidget, GUI.Ui_Pycloud):
      def __init__(self):
          super(self.__class__, self).__init__()
          self.setupUi(self)
          self.password.setEchoMode(QtGui.QLineEdit.Password)
  
          """Picking up data from GUI.py file where initially,
          it is set to 'Username' and 'Password' respectively.
          and initialising `GetThread` class"""
          self.get_thread = GetThread(str(self.username.text()), 
                                      str(self.password.text())
                                     )
          """This is what I was initially using.
             I have tried, only passing the instance and calling 
             get_thread.start() inside __init__ fn but even if i don't click 
             `commandLinkButton` it is somehow called automatically.
             I know it is not the right approach"""
          self.commandLinkButton.clicked.connect(self.get_thread.start)
  
  
  class GetThread(QThread):
  
      def __init__(self, username, password):
          QThread.__init__(self)
          self.username = username
          self.password = password
  
      def __del__(self):
          self.wait()
  
      def authentication(self):
          print self.username, self.password
          # user = Photos.PyPhotos(self.username, self.password)
          # user.authentication(user)
  
      def run(self):
          self.authentication()
  
  
  def main():
      app = QtGui.QApplication(sys.argv)
      form = PyMain()
      form.show()
      app.exec_()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Below is what I tried:</p>
  
  <pre><code>...........................
  ...........................
  ...........................
  
  class PyMain(QtGui.QWidget, GUI.Ui_Pycloud):
    def __init__(self):
      super(self.__class__, self).__init__()
      self.setupUi(self)
      self.password.setEchoMode(QtGui.QLineEdit.Password)
      self.commandLinkButton.clicked.connect(GetThread(str(self.username.text()), 
                                               str(self.password.text())).__init__)
  
  class GetThread(QThread):
  
   def __init__(self, username, password):
          QThread.__init__(self)
          self.username = username
          self.password = password
          self.start()
  ...........................
  ...........................
  ...........................
  </code></pre>
  
  <p><strong>Result:</strong> <code>Username Password</code><br></p>
  
  <blockquote>
    <p>Which is shown the moment I run my <code>main.py</code> file, whereas I should get this only and only if I press <code>commandLinkButton</code> and should update variables if I update them on my GUI which is not happening.<br><br></p>
  </blockquote>
  
  <p><strong>EDIT:</strong> Below is what I tried again, it is showing me the correct output if I update them on GUI but threading is not working in this case:</p>
  
  <pre><code>..............
  ..............
  ..............
  class PyMain(QtGui.QWidget, GUI.Ui_Pycloud):
      def __init__(self):
          super(self.__class__, self).__init__()
          self.setupUi(self)
          self.password.setEchoMode(QtGui.QLineEdit.Password)
          self.commandLinkButton.clicked.connect(self.populate)
  
      def populate(self):
          get_thread = GetThread(str(self.username.text()), str(self.password.text()))
          get_thread.start()
  
  
  class GetThread(QThread):
  
      def __init__(self, username, password):
          QThread.__init__(self)
          self.username = username
          self.password = password
  
      def __del__(self):
          self.wait()
  
      def authentication(self):
          print self.username, self.password
          user = Photos.PyPhotos(self.username, self.password)
          user.authentication(user)
  
      def run(self):
          self.authentication()
  ......................
  ......................
  ......................
  </code></pre>
  
  <p>So anyone can please tell me how to approach this?</p>