takes at least 3 arguments (2 given)

51 views
Skip to first unread message

Félix CT

unread,
Sep 10, 2015, 8:52:34 PM9/10/15
to Python Programming for Autodesk Maya
Hello this is my first post, I have troubles with this small script, if anyone could help me, that would be great.

The script:

import maya.cmds as cmds

def myName( self, nombre, apellido, *args ):
print ( nombre + "_" + apellido )

def myWin():
cmds.window()
cmds.columnLayout()
cmds.button( label= 'Press', c= myName( nombre='Pepe', apellido='Grillo' ) )
cmds.showWindow()

myWin()

This is the error:

#TypeError: myName() takes at least 3 arguments (2 given)


Saludos!!

Kurian O.S

unread,
Sep 10, 2015, 8:57:56 PM9/10/15
to python_in...@googlegroups.com
http://pastebin.com/y0nBAy9W Try this

If you want to pass a argument to another function you can use partial or lambda, But I will stay with partial :)


--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b58aa1c8-013b-48a8-8499-01a1e2ee9be1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--:: Kurian ::--

Félix CT

unread,
Sep 10, 2015, 9:42:17 PM9/10/15
to Python Programming for Autodesk Maya
Gracias!! I been stuck hours in this script!
Reply all
Reply to author
Forward
0 new messages