Hi,
If you don't need more than 4 checkBoxes, there is the checkboxGrp command.
It manages the checkboxes for you so you only have one checkbox active.
Otherwise, about your code, I have no maya access right now, but maybe your
error is due to
querying currentState (which is a bool?)  instead of widget:

> if hasattr(self, 'currentState'):
>     self.currentState = cmds.rowLayout(*widget*,q=True,enable=False)


Also, you can use kwargs when you build a command with partial; It helps
disambiguate the arguments given by the caller:

> cmds.checkBox(self.rBtn, e=
> True,cc=partial(self.changeBox,layout=self.rLayout))
> def changeBox(self,layout=None,*args):
>      if not layout:
>
            return

 etc...


Le lun. 24 déc. 2018 23:03, James Kim <[email protected]> a écrit :

> Hi,
>
> I am building a ui an I am using checkboxes to enable sliders. Currently
> selecting and deselecting checkboxes enables and disables my sliders which
> is all well and good but I am trying to get it so when I select a checkbox
> it disables all other checkboxes. I have the checkbox's command set to a
> different function which i use to to enable and disable the corresponding
> sliders. I tried using an if statement but it gives me an error," Error:
> RuntimeError: file <maya console> line 38: Object 'False' not found."
> Here is my code so far
>
> class sliderWindow():
>
>     def __init__(self):
>         self.name = 'windtest'
>         self.size = [500, 500]
>
>         if cmds.window(self.name, exists=True):
>             cmds.deleteUI(self.name, window=True)
>
>     def windMain(self):
>
>         main = cmds.window(self.name, widthHeight=self.size,sizeable=True)
>         cmds.columnLayout()
>
>         self.rBtn = cmds.checkBox(label='test1', enable=True)
>         self.rLayout = cmds.rowLayout(nc = 3,enable=False)
>
>         self.slider1 = cmds.floatSliderGrp(label = 'TestS1', field = True,
> min = 0.000, max = 1.000, value = 0.500, step = 0.001)
>         cmds.setParent('..')
>         cmds.checkBox(self.rBtn, e=
> True,cc=partial(self.changeBox,self.rLayout))
>
>
>
>         self.gBtn = cmds.checkBox(label='test2', enable=True)
>         self.gLayout = cmds.rowLayout(nc=3,enable=False)
>         self.slider2 = cmds.floatSliderGrp(label='testS2', field=True,
> min=0.000, max=1.000, value=0.500, step=0.001)
>         cmds.setParent('..')
>         cmds.checkBox(self.gBtn, e=True, cc=partial(self.changeBox,
> self.gLayout))
>
>
>
>         cmds.showWindow(main)
>
>
>     def changeBox(self,widget,*args):
>
>         if hasattr(self, 'currentState'):
>             self.currentState =
> cmds.rowLayout(self.currentState,q=True,enable=False)
>
>         self.currentState = cmds.rowLayout(widget,q=True,enable=True)
>         cmds.rowLayout(widget,e=True,enable=(1-self.currentState))
>
> any help is appreciated. Thank you!
>
>
>
>
>
>
>
>
>
> --
> 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/d2e2e651-0459-4214-8722-4c972f521cff%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/d2e2e651-0459-4214-8722-4c972f521cff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAD65uqmSAW0vpc55MXq8pCWZqbqnake02UPeXeyh9tDi%3DphGgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to