Hello all, I'm a Softimage user needing to move over and get familiar with 
Maya. I apologize in advance if I post any stupid questions. Does this list 
have its own search function? I looked for one but couldn't find any.

I'm using Maya 2015 on Windows at the moment and I'm having trouble with my 
userSetup.py file. Basically, I want to create a custom menu in the menu 
bar at launch. After googling some tutorials on the matter, I have code 
that works great when fired from the the script editor, but when run at 
launch, it bombs. Basically my function to build the window is unable to 
get a handle on the main Maya window... it gets returned as *NoneType*. The 
relevant part of my code looks something like this:


def buildMenu():
    ptr = mui.MQtUtil.mainWindow()
    mayaWindow = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
 
    mainMenu = cmds.menu('MyMenu', p=mayaWindow, l='My Menu')
    cmds.menuItem(p=mainMenu, d=True, dl='Some Divider')
    cmds.menuItem(p=mainMenu, l='Some Tool')


The error comes from *wrapInstance(long(ptr))*, because *ptr *is being 
returned as *None*. I'm unsure how to proceed. It basically seems as though 
my code is getting run *before *the main window has initialized, so it 
doesn't exist yet?

Thank you for any assistance...

-Tim Crowson
CG Lead, Magnetic Dreams

-- 
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/cf9a9f08-7a78-44c4-9a6e-c225f50424e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to