title: Pausing a loop in python
body: <p>I have a loop that creates windows using PySide depending on the number the user enters 
  each window will have some calls for other functions.<br>
  I would like the second window opens after all the commands belongs to the first window is done.<br>
  So, Is there a way in Python to tell the loop to stop until a certain flag is True for example </p>
  
  <p>Here's what I'm doing </p>
  
  <pre><code>for i in range(values):
      self.CreatWindow()      # the function that creates the window
  
  
  
  def CreatWindow(self):
      window = QtGui.QMainWindow(self)
      window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
      combo = QtGui.QComboBox(window)
      combo.addItem(" ")
      combo.addItem("60")
      combo.addItem("45")
      combo.activated[str].connect(self.onActivated)  
  
      btn = QtGui.QPushButton('OK', window)
      btn.clicked.connect(self.ComputeVec)
      window.show()
  
  def onActivated(self, text):
      angle = int(text)
  
  def ComputeVec(self):
      window.close()
      getVecValue(angle)
  </code></pre>
  
  <p>Now in that function the window have some calls to other functions, and I want to set the flag to True in the last function <code>getVecValue</code> which will do some computations and store the result. </p>