title: pyqt: How to dynamically update widget property on outer variable value change?
body: <p>I have <code>class Ui_MainWindow(object)</code> that creates a window with a progress bar and <code>class OtherClass(object)</code> that contains method in which the local int variable increments in cycle.</p>
  
  <p>How to connect local variable value change to progres bar value change?</p>
  
  <h1>mainGUI.py</h1>
  
  <pre><code>import sys
  from PyQt4.uic.Compiler.qtproxies import QtGui
  from PyQt4 import QtGui
  from Ui_MainWindow import Ui_MainWindow
  
  def main():
  
      app = QtGui.QApplication(sys.argv)
      MainWindow = QtGui.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <h1>Ui_MainWindow.py</h1>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  from MainGui.OtherClass import OtherClass
  
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      _fromUtf8 = lambda s: s
  
  class Ui_MainWindow(object):
  
      def myButtonSlot(self):
          objVar=OtherClass()
          objVar.method()
  
      def setupUi(self, MainWindow):
          MainWindow.setObjectName(_fromUtf8("MainWindow"))
          MainWindow.resize(389, 332)
          self.centralwidget = QtGui.QWidget(MainWindow)
          self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
          self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
          self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
  
          self.pushButton = QtGui.QPushButton(self.centralwidget)
          self.pushButton.setObjectName(_fromUtf8("pushButton"))
          self.pushButton.clicked.connect(self.myButtonSlot)
          self.verticalLayout.addWidget(self.pushButton)
  
          self.progressBar = QtGui.QProgressBar(self.centralwidget) 
          self.progressBar.setProperty("value", 24)
          self.progressBar.setObjectName(_fromUtf8("progressBar"))
  
          self.verticalLayout.addWidget(self.progressBar)
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtGui.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 389, 21))
          self.menubar.setObjectName(_fromUtf8("menubar"))
          MainWindow.setMenuBar(self.menubar)
          self.statusbar = QtGui.QStatusBar(MainWindow)
          self.statusbar.setObjectName(_fromUtf8("statusbar"))
          MainWindow.setStatusBar(self.statusbar)
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
          self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "PushButton", None, QtGui.QApplication.UnicodeUTF8))  
  </code></pre>
  
  <h1>OtherClass.py</h1>
  
  <pre><code>class OtherClass(object):  
      def method(self):
          for i in range(100): # i want to connect variable i to progress bar value
              print i 
              for j in range(100500):
                  pass
  </code></pre>