There are almost always multiple widgets in Nuke's UI that are instances of QMainWindow, but there is a `Foundry::UI::DockMainWindow` class that inherits QMainWindow, and more or less represents the main application window (with the menu bar, etc).
You can find it like this: for w in QtGui.qApp.topLevelWidgets(): if w.inherits('QMainWindow') and w.metaObject().className() == 'Foundry::UI::DockMainWindow': break else: raise RuntimeError('Could not find DockMainWindow instance') # `w` is the widget instance -Nathan From: Kurian O.S Sent: Monday, September 28, 2015 3:02 PM To: Nuke Python discussion Subject: Re: [Nuke-python] Getting Nuke Main Window Instance That works, but if we have multiple instance then its getting confused. But yeah 95 % it works. Thanks Erik On Mon, Sep 28, 2015 at 12:26 PM, Erik Johansson <erik.johans...@fido.se> wrote: QtGui.QApplication.activeWindow() Should work On Sep 28, 2015 9:22 PM, "Kurian O.S" <kuria...@gmail.com> wrote: Hey All, Is there any fast way to get the nuke main window instance with pyside or pyqt ? in maya they have import maya.OpenMayaUI as mui ptr = mui.MQtUtil.mainWindow() parent = sip.wrapinstance(long(ptr), QtGui.QMainWindow) Do Nuke have something similar ? Thanks -- --:: Kurian ::-- _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python -- --:: Kurian ::-- -------------------------------------------------------------------------------- _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python