My QMessageBox.question buttons didn't show up

243 views
Skip to first unread message

Michael Boon

unread,
Aug 1, 2017, 8:31:43 PM8/1/17
to Python Programming for Autodesk Maya
Hi, I've just had a bug report from someone who had to force close Maya 2017 because I popped up a QMessageBox and the buttons that were supposed to be on it were missing.

Here's a sanitised version of my code. parentWin is a QMainWindow whose parent is the Maya window.
from PySide2 import QtWidgets
message = 'This is the message'
choice = QtWidgets.QMessageBox.question(
    parentWin,
    'Dialog title', 
    message,
    QtWidgets.QMessageBox.Yes |
    defaultButton=QtWidgets.QMessageBox.Yes)

I know many years ago, Windows could run out of resources and things like this could happen but I haven't heard of anything like that for at least 5 years. Can anyone speculate why this could happen under Windows 10?

Marcus Ottosson

unread,
Aug 2, 2017, 1:01:24 AM8/2/17
to python_in...@googlegroups.com
If it happened under Maya 2017 pre update 4, then it could be a Maya issue more than anything else. PySide2 is under heavy development even as we speak.

Michael Boon

unread,
Aug 2, 2017, 2:11:34 AM8/2/17
to Python Programming for Autodesk Maya
Good point, thanks.

Ravi Jagannadhan

unread,
Feb 18, 2018, 7:24:27 PM2/18/18
to python_in...@googlegroups.com
Hi all, so I'm seeing this happen on Maya 2017 Update 4 on MacOS and wondering if anyone's seen similar behaviour in their versions. Like Michael, I'm trying to use a QMessageBox. My script looks like this: 

---- SNIP ---- 
import logging
import Qt
from Qt import QtGui, QtCore, QtWidgets

try:
    from Qt import QtUiTools
except ImportError as e:
    if Qt.__binding__ in ('PySide'):
        from PySide import QtUiTools
    else:
        from PySide2 import QtUiTools
       
msgBox = QtWidgets.QMessageBox()
msgBox.setText('What to do?')
msgBox.addButton(QtWidgets.QPushButton('Accept'), QtWidgets.QMessageBox.YesRole)
msgBox.addButton(QtWidgets.QPushButton('Reject'), QtWidgets.QMessageBox.NoRole)
msgBox.addButton(QtWidgets.QPushButton('Cancel'), QtWidgets.QMessageBox.RejectRole)
ret = msgBox.exec_() 
---- SNIP ---- 

Any ideas?

Thank you for your time,
Ravi

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3c4ac731-a67f-4823-87b4-efd72fc57121%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan
Reply all
Reply to author
Forward
0 new messages