On Tue, Dec 25, 2018, 11:03 AM James Kim <[email protected]> wrote:
> 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))
>
I don't know which line is 38. It would help if you shared this code as a
pastebin in the future. But I think it's those last lines where you are
passing a bool return value as if it were the layout name
if hasattr(self, 'currentState'):
self.currentState =
cmds.rowLayout(self.currentState,q=True,enable=False)
After you query if it's true or false it is no longer a string. I think you
meant to pass a layout name.
> 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/CAPGFgA2-Cnx8bG3T9u8QdhD%2B4OxGMkC9AGukXHacTYjqKuf1JQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.