我有一个循环,它根据用户输入的数字使用PySide创建windows

每个窗口都会调用一些其他函数。

我希望在完成属于第一个窗口的所有命令后打开第二个窗口。

那么,Python中有没有一种方法可以告诉循环停止,直到某个标志为真

这就是我要做的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)

现在在这个函数中,窗口有一些对其他函数的调用,我想在最后一个函数getVecValue中将标志设置为True,该函数将执行一些计算并存储结果。在