Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I am doing some experiment with Pyside and Maya 2022
I have followed this reference page from Autodesk
but I got a problem with this line :
widget = wrapInstance( long(ptr), QWidget)
Wich gives me ;
# Error: NameError: file <maya console> line 12: name 'long' is not defined #
And obvioulsy type of ptr is <class 'SwigPyObject'>
Here is the code
from maya import cmds
from maya import mel
from maya import OpenMayaUI as omui
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from shiboken2 import wrapInstance
omui.MQtUtil.mainWindow()
ptr = omui.MQtUtil.mainWindow()
print(type(ptr))
widget = wrapInstance( long(ptr), QWidget)
Where is the mistake ?
Solved! Go to Solution.