def testWin(): default_options = cmds.optionVar( stringValue=( ("checkbox_state", False), ) ) # This will returns me False print cmds.optionVar(q="checkbox_state") w = cmds.window() col = cmds.columnLayout() chk_state = bool(cmds.optionVar(q="checkbox_state")) # But it will checked the checkbox though it should be False initially chkBox = cmds.checkBox("chk_box", label="checkbox state Testing", value=bool(chk_state)) btn = cmds.button('print', c=print_state) return w
def print_state(*args): state = cmds.checkBox("chk_box", query=True, value=True) # Returns me the current state - True/ False print state
def win_closure(*_): #cmds.checkBox("chk_box", query=True, value=True) # Returns me nothing cmds.optionVar(stringValue=("checkbox_state", cmds.checkBox("chk_box", q=True, value=True))) print "window " + w + " was deleted"
win = testWin()cmds.scriptJob(uiDeleted = (win, win_closure), runOnce=True)cmds.showWindow(win)
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4fc79cee-c18b-4c76-bb87-3dee2ee4f1a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Justin, many thanks for the reply, that seems to have do the trick.Wondering if you could also share any insights into `# RuntimeError: Object 'chk_box' not found. #` whenever I tried to relaunch/ rerun the 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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e0ec520e-6b6c-4dae-9946-dfa83cd80b96%40googlegroups.com.