I am trying out using maya symbolcheckbox and I run into a few issue. In my 
actual code, I have a 'add', 'remove' and 'clear' button and so if any of 
these 3 buttons are clicked onto, it will called its own functions. In my 
code, it was written something as follow:

self.btn_add = cmds.symbolButton( width=60, height=20, annotation='Add 
object(s)', image='add.xpm', command=lambda * args:self.btnCallback("add", 
"item_list") )

def uiListCallback(self, *args):
    mode = args[0]

    text_list = args[1]
    if mode == "add":
        # do this
    elif mode == "remove"
        # do that


But when I tried to create a function for each action, I keep getting 
errors.
This is simple example, but it illustrates the problem I had.

However, if I execute the following code:
def greet():
    print 'hello'

def main():
    cmds.window()
    cmds.columnLayout()
    cmds.symbolCheckBox(image='circle.png', changeCommand=greet())
    cmds.showWindow()
main()

I will get `# Error: TypeError: file <maya console> line 9: Invalid 
arguments for flag 'changeCommand'.  Expected string or function, got 
NoneType # `

But if I did it in another way:
def greet():
    print 'hello'

def main():
    cmds.window()
    cmds.columnLayout()
    # () was added into greet under the command flag
    cmds.symbolCheckBox(image='circle.png', command=greet())
    cmds.showWindow()
main()

While I get a popup, but as soon as I click on it, I will get this error - 
`# Error: greet() takes no arguments (1 given) # `

Where am I doing it wrong?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/eeb056cb-04b7-4989-82eb-88fe0b5b62f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to