title: Busy indication with PyQt progress bar
body: <p>I'm trying to write a script which will display a busy indication
  while performing the task. And when the task is over, the progress bar
  will fill to the end showing that 100% task has been completed.
  I just want the progress bar to show a task is going on.But when I start 
  the task, busy indication stops.It seems to me that the indication and
  the task can not continue together. Please help me. Here's mycode: </p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  from time import sleep
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      def _fromUtf8(s):
          return s
  
  try:
      _encoding = QtGui.QApplication.UnicodeUTF8
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig, _encoding)
  except AttributeError:
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig)
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName(_fromUtf8("MainWindow"))
          MainWindow.resize(344, 159)
          self.centralwidget = QtGui.QWidget(MainWindow)
          self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
          self.pb = QtGui.QProgressBar(self.centralwidget)
          self.pb.setGeometry(QtCore.QRect(20, 20, 301, 31))
          self.pb.setProperty("value", 0)
          self.pb.setObjectName(_fromUtf8("pb"))
          self.btn = QtGui.QPushButton(self.centralwidget)
          self.btn.setGeometry(QtCore.QRect(20, 70, 98, 27))
          self.btn.setObjectName(_fromUtf8("btn"))
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtGui.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 344, 25))
          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.QObject.connect(self.btn, QtCore.SIGNAL(_fromUtf8("clicked()")), self.action)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)            
  
      def action(self):
          self.pb.setRange(0, 0)
          sleep(3) # Here I want to run a command.For example: os.system('copy something')
          self.pb.setRange(0, 100)
          self.pb.setValue(100)
          QtGui.qApp.processEvents()
  
      def retranslateUi(self, MainWindow):
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
          self.btn.setText(_translate("MainWindow", "Start", None))
  
  
  if __name__ == "__main__":
      import sys
      app = QtGui.QApplication(sys.argv)
      MainWindow = QtGui.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>