def choose(choices, within_qtloop = False, parent = None):
if not within_qtloop:
app = QApplication(sys.argv)
dialog = ChoiceDialog(choices, parent)
result = dialog.open() # show() will not get result
app.exec_() # dialog.exec_() will call the app.exec_()
else:
dialog = ChoiceDialog(choices, parent)
result = dialog.exec_() # show() will not get result, must using exec_() or error
choice = dialog.getChoice()
choiceId = dialog.getChoiceId()
return (choice, choiceId, result == QDialog.Accepted) # Accepted
评论列表
文章目录