I have a registered command that is assigned to a 'Window' class:
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.registerCommand('ui', Window)
except:
sys.stderr.write( "Failed to register node: %s\n" % kPluginNodeTypeName )
class Window(OpenMayaMPx.MPxCommand):
def doIt(self, argList):
#parsing arglist with MArgParser with -title, -width, etc...
...
def CreateWindow(self, title, width, ...):
...
def AddButton(self, label, width, ...):
...
cmds.ui(t='myWindowTitle', w=200)
# Window Created
What I am looking to do is to be able to call something like:
#anyway to reference AddButton()?
>>>cmds.ui.AddButton(...)
# Error: AttributeError: file <maya console> line 2: 'function' object has
no attribute 'AddButton' #
This whole 'doit' is a pain in the a$$ seeing how it can't return anything
(Or I haven't had any luck with returning objects):
self.window['window'] = cmds.window('myWindow')
cmds.showWindow(self.window['window'])
return self.window['window']
<<<myWindow = cmds.ui(t='MyWindow')
<<<print myWindow
>>>None
Has anyone gotten any form of inner method calls of these commands from
cmds calls? It would really help to instance this Window and just attach my
elements, if not I don't know how I am going to achieve this...
As usual, thank you for any help or time!
--
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/03f00036-8089-4d38-8bd5-236ece947d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.