我好像碰到了砖墙。不管我做什么,创建一个关键错误消息框似乎都不起作用。以下是我迄今为止所做的尝试:
flags = QtGui.QMessageBox.StandardButton.Abort
flags |= QtGui.QMessageBox.StandardButton.Ignore
result = QtGui.QMessageBox.critical(
self,
'CRITICAL ERROR',
'Error Message',
flags
)
从this tutorial(我知道,但到目前为止,它是有用的)。但是,执行此操作会出现以下错误:
'PySide.QtGui.QMessageBox.critical' called with wrong argument types:
PySide.QtGui.QMessageBox.critical(CreateMessage, str, StandardButtons)
Supported signatures:
PySide.QtGui.QMessageBox.critical(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QMessageBox.StandardButtons = QMessageBox.Ok, PySide.QtGui.QMessageBox.StandardButton = NoButton)
PySide.QtGui.QMessageBox.critical(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QMessageBox.StandardButton, PySide.QtGui.QMessageBox.StandardButton)
我也尝试了以下方法:
^{pr2}$这些似乎都不能正常工作。如何创建严重错误消息框?在
下面是一个简单的例子
Here's an example from Qt.Gitorious。在
回答您的问题you can check the documentation:
^{pr2}$在本例中,parent=self,title=自我.tr("QMessageBox.showCritical()),文本=对话框.MESSAGE,按钮=QtGui.QMessageBox.Abort| QtGui.QMessageBox.StandardButton.重试|QtGui.QMessageBox.StandardButton。忽略
tr只是一些设置翻译的Qt函数,基本上是一个字符串。我真的不能告诉你你做错了什么,看看错误信息,它似乎解析错了东西。可能是因为你给标志赋值的方式。在
这个例子还展示了如何处理关键对话框的结果,这似乎很有用。在
相关问题 更多 >
编程相关推荐