That’s brilliant, Fredrik. I did some tests and it looks like it’s returning the currently active window (duh!), which in the case of running from the Script Editor is the Script Editor window. Not sure it has any repercussions and shouldn’t be an issue when *not* running from the Script Editor.
However, I also tried this. from PySide import QtGui # Returns the Script Editor, sometimes. window = QtGui.QApplication.activeWindow()assert window.objectName() == 'scriptEditorPanel1Window' # Returns the Maya Window, for sure widgets = dict((w.objectName(), w) for w in QtGui.QApplication.allWidgets()) window = widgets['MayaWindow'] On 6 October 2014 14:35, Fredrik Averpil <[email protected]> wrote: > > Then it looks like you just stumbled upon a holy grail. :) Fetching this >> handle has always been a PITA and this looks simple and logical. Will be >> trying this out next. Thanks! >> > Nice, let me know how it works. I have only used this with QMainWindow and > QDialog. I don't think it will work with QWidget. > > > >> I may be wrong here but I also think exec_() available for >> QtGui.QWidget. >> >> You can see everything it supports here: >> http://qt-project.org/doc/qt-4.8/qwidget-members.htm >> <http://qt-project.org/doc/qt-4.8/qwidget-members.html> >> > Ah... so QWidget did not have exec_(). > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNV2JDE%3DDxZ1GjjYmYaKsuuTaJCEjsQfXLwud5QgkNAWg%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNV2JDE%3DDxZ1GjjYmYaKsuuTaJCEjsQfXLwud5QgkNAWg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAw_CeoaX3KCrp%3DufRJ5yh%2B3HzUMLyC0y2T%3Dk%2BgZNF_ag%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
