Hi all, I am trying to split maya gui commands into another file, from the 
main code, like what you may do when dealing with PyQt.. Main code in a 
file while the UI code in another, for the sake of better maintaining the 
code.

Here is my code:

myUI.py
from maya import cmds
import myCode as my

WINID = "MyUI"


def ui():
    if cmds.window(WINID, exists=True):
    cmds.deleteUI(WINID)

  cmds.window(WINID, title="TestUI", width=165, height=140,
              sizeable=False, resizeToFitChildren=True)

    cmds.columnLayout(adjustableColumn=True)
  cmd.rowColumnLayout(numberOfColumns=3, columnAttach=[1, "right", 0],
                      columnWidth=[2, 250])

    cmds.text(label="")
  cmds.checkBox("chk01", label="My checkbox 01",
                value=True, changeCommand=my.get_state)
    cmds.text(label="")
  
    cmds.showWindow(WINID)

myCode.py
from maya import cmds

def get_state(*args):
    check_state = cmds.checkBox("chk01", value=True, query=True)
    print check_state


When I tried to uncheck the option in the UI, I got the following error:
# Error: get_state() takes no arguments (1 given)
# TypeError: get_state() takes no arguments (1 given) # 


Tried adding in `*args` into the `get_state()` but getting the same error.
Is it possible to do so when dealing with only maya code?

-- 
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/4e7d9dea-a1de-4b9b-a01d-ad27c62e8de5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to