Maya脚本:创建用户界面(行和列)时出现问题

时间:2014-02-04 00:09:15

标签: python user-interface layout row maya

我想创建一个具有如下项目分布的用户UI:

enter image description here

在大矩形上我想要一个滑动条。问题是我无法让它发挥作用。我尝试在同一个窗口中指定两个不同的布局,Maya很有趣,告诉我有太多的孩子或类似的东西。在这里,我把我到目前为止的东西:

cmds.window(windowID, title='Towers Of Hanoi', sizeable=False, resizeToFitChildren=True)
cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1,90),(2,80)], columnOffset=[(1,'right',5),(2,'right',5)])

cmds.text(label='Num. of Disks:')
cmds.separator( h=10, style='none' )

cmds.separator( h=5, style='none' )
cmds.separator( h=5, style='none' )

# WHAT DO I DO HERE?
diskNumUIField = cmds.intScrollBar(min=2, max=12, value=0, step=1, largeStep=2)
cmds.separator( h=10, style='none' ) 
# This thing above is where my problem is?

cmds.separator( h=5, style='none' )
cmds.separator( h=5, style='none' )

cmds.button(label='Place Disks', width=75, command=blablabla())
cmds.button(label='Clear All', width=75, command=blablabla())

cmds.separator( h=5, style='none' )
cmds.separator( h=5, style='none' )

cmds.button(label='Solve it!', width=75, command=blablabla())
cmds.button(label='Exit', width=75, command=blablabla())

cmds.separator( h=5, style='none' )
cmds.separator( h=5, style='none' )

cmds.showWindow()

I don't want that to happen

感谢你看一下。

2 个答案:

答案 0 :(得分:2)

我相信你要找的是intSliderintSliderGrp,而不是intScrollBar,它不存在......感谢@theodox:P

答案 1 :(得分:1)

使用嵌套columnLayout的{​​{1}}:

enter image description here

rowLayout

NB:您的按钮命令有括号。这会在构建按钮之前调用函数。您需要删除括号才能在单击时调用该函数。