pm.Callback is basically the same as the standard lib functools.partial,
except that is wraps an undo around it, and you have to import and use
pymel. The pymel source actually imports functools, but doesn't use it to
store the callback.


On Mon, Jul 23, 2012 at 11:38 AM, hapgilmore <[email protected]> wrote:

> try PyMel's Callback(). It handles additional args nicely:
>
> self.submit = cmds.button(label='submit', w=215,
> command=pm.Callback(self.doSomething, foo))
>
> def doSomething(self, foo):
>     print foo
>
>
> On Sunday, July 15, 2012 10:32:52 AM UTC-6, Panupat wrote:
>>
>> I'm learning how to create python UI. So I made a class with a text field
>> and a button.
>>
>> self.input = cmds.textFieldGrp(label=' label')
>> self.submit = cmds.button(label='submit', w=215, command=self.doSomething)
>>
>> def doSomething(self):
>>     print "OK"
>>
>> The button isn't doing anything, but when I clicked it I got this error
>>
>> TypeError: doSomething() takes exactly 1 argument (2 given) #
>>
>> Why is the function getting 2 arguments? What is it receiving?
>>
>  --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to