I seem to be hitting a brick wall. No matter what I do, creating a critical error Message Box just doesn't seem to be working. Here's what I've tried thus far:
flags = QtGui.QMessageBox.StandardButton.Abort
flags |= QtGui.QMessageBox.StandardButton.Ignore
result = QtGui.QMessageBox.critical(
self,
'CRITICAL ERROR',
'Error Message',
flags
)
As taken from this tutorial (old I know, but it's been helpful thus far). Doing this however, brings up the following error:
'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)
I've also tried the following:
result = QtGui.QMessageBox.critical(
self,
'CRITICAL ERROR',
'Error Message',
QtGui.QMessageBox.StandardButton.Abort
)
# Or this....
result = QtGui.QMessageBox.critical(
self,
'CRITICAL ERROR',
'Error Message',
QtGui.QMessageBox.Abort
)
None of these seem to work properly. How do I create a critical error message box?
Simple Example Below
Here's an example from Qt.Gitorious.
To answer your question you can check the documentation:
In the example, parent = self, title = self.tr("QMessageBox.showCritical()"), text = Dialog.MESSAGE, buttons = QtGui.QMessageBox.Abort | QtGui.QMessageBox.StandardButton.Retry | QtGui.QMessageBox.StandardButton.Ignore
The tr is just some Qt function to set up translations, basically its a string. I can't really tell you what you did wrong, looking at the error message, it seems to have parsed things wrong. Possibly because of the way you assigned values to flags.
The example also shows how to deal with the result of the critical dialog, which seems useful.