Perhaps better to use PyMEL which, among many other things, has taken this
into consideration and provides a "Callback" object. The following page
describes the whole scenario which led to the creation of the mechanism
(including the use of lambda):
http://help.autodesk.com/cloudhelp/2016/ENU/Maya
Thanks a lot guys.
Works!
Yury
--
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_maya+unsubscr...@googlegroups.com.
To vi
Hi Yury,
This is happening because the Python lambda does not create a real closure.
It only captures the scope, and then does lazy evaluation of the variables.
What that means is, if you are attempting to create a closure over
variables in a loop, what you get is a capture of the loop scope, and
First you had syntax issues and I really don't like lambda in this case
used partial
import maya.cmds as mc
from functools import partial
def blah(value, *args):
print "I was given:", value
mc.window(w=500, h=500);
mc.columnLayout();
for i in range(0, 5):
mc.button(l="Touch!"+str(i), c=pa
hey guys
I have this little code.
*import maya.cmds as mcdef blah(value):print "I was given:",
valuemc.window(w=500, h=500)mc.columnLayout()for i in range(0, 5):
mc.button(l="Touch!"+str(i), c=lambda x:blah(10*i))mc.showWindow()*
if you run this it will create a window with 5