PySide2/QtWidgets problem in setStandardButtons
-
wrote on 19 May 2023, 16:54 last edited by
-
Thats te code I used to create a message box with just yes and no options
But I'm getting this error
TypeError: 'PySide2.QtWidgets.QMessageBox.StandardButton' object cannot be interpreted as an integerBut if I put njust one button, it works
I'm using QMessageBox from PySide2.QtWidgetswrote on 19 May 2023, 18:28 last edited by JonB@ZEZON
Please paste code not screenshots so people can copy from it.Your code should be working, but I'm afraid it looks like it isn't due to some PySide2->Python issue. https://www.pythonguis.com/tutorials/pyside-dialogs/ for PySide2 even includes same line as you. If you can test under PyQt5 that would confirm.
I don't suppose it will help, but try:
buttons = QMessageBox.Yes | QMessageBox.No mais.setStandardButtons(buttons)
Actually, if you try the above one and it errors please show which of the two lines it complains about, that would be useful to know.
I don't know whether something like
buttons = QMessageBox.StandardButton(QMessageBox.Yes | QMessageBox.No) mais.setStandardButtons(buttons)
would work.
1/2