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