Notifications
Clear all

[Closed] MaxPlus Main window Wrapping problem

Hi,
I am trying to hook up my pySide widget to the max’s main window. If i don’t try to parent it, it’s working fine, but i don’t know for some reason max is not giving system exception if I am wrapping Instance of the max window thru shiboken

code not Working:

import MaxPlus
from PySide import QtCore,QtGui
from PySide.shiboken import wrapInstance

def getMaxWindow():
    ptr = MaxPlus.Win32.GetMAXHWnd()
    return wrapInstance(long(ptr), QtGui.QWidget)

class createUI(QtGui.QWidget):
    def __init__(self, parent=getMaxWindow()):
        super(createUI,self).__init__(parent)
        self.setWindowTitle("Test UI")
        self.resize(200,100)

if __name__ == '__main__':
    ui=createUI()
    ui.show()

If I remove the parent variable, its all fine. Any clues why???