Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to get Maya's main window with Python API 2.0?

How to get Maya's main window with Python API 2.0?

g2m.agent
Collaborator Collaborator
2,667 Views
1 Reply
Message 1 of 2

How to get Maya's main window with Python API 2.0?

g2m.agent
Collaborator
Collaborator

This code is provided in the manual:

from maya import OpenMayaUI as omui
omui.MQtUtil.mainWindow()    
ptr = omui.MQtUtil.mainWindow()  

but in Python API 2.0, there is no "MQtUtil".

 

Therefore, my conclusion is that if you want to use Python API2.0, you cannot use PySide2.

Is that right?

0 Likes
Accepted solutions (1)
2,668 Views
1 Reply
Reply (1)
Message 2 of 2

zewt
Collaborator
Collaborator
Accepted solution

I don't know if there's a separate OM2 binding, but you can just use OM1 for this.  Since this is just giving you a pointer to a Qt object, it's fine to use OM1 here even if you also have OM2 code.

 

0 Likes