jim204
11-28-2011, 01:08 PM
Hi,
I am trying to run a function with the button command but I get the following error printed when I click the button in the window
# Error: TypeError: pyFunc() takes no arguments (1 given) #
This is the code I am running
import maya.cmds as mc
def pyFunc ():
print 'test'
pyWindow = mc.window (w=200,h=200)
mc.columnLayout (height=200, width=200)
pyButt = mc.button (label='test')
mc.button(pyButt, edit=True, command=pyFunc)
mc.showWindow (pyWindow)
If I do a similar thing in MEL it works
global proc melProc()
{
print "test";
}
string $melWin =`window -width 200 -height 200` ;
columnLayout -width 200 -height 200;
string $melButt = `button -label "test"`;
button -edit -command melProc $melButt;
showWindow $melWin
Any ideas why python is getting an argument? and how I can rectify the issue?
Any help would be much appreciated!
Cheers,
Jim
I am trying to run a function with the button command but I get the following error printed when I click the button in the window
# Error: TypeError: pyFunc() takes no arguments (1 given) #
This is the code I am running
import maya.cmds as mc
def pyFunc ():
print 'test'
pyWindow = mc.window (w=200,h=200)
mc.columnLayout (height=200, width=200)
pyButt = mc.button (label='test')
mc.button(pyButt, edit=True, command=pyFunc)
mc.showWindow (pyWindow)
If I do a similar thing in MEL it works
global proc melProc()
{
print "test";
}
string $melWin =`window -width 200 -height 200` ;
columnLayout -width 200 -height 200;
string $melButt = `button -label "test"`;
button -edit -command melProc $melButt;
showWindow $melWin
Any ideas why python is getting an argument? and how I can rectify the issue?
Any help would be much appreciated!
Cheers,
Jim
