我在maya中使用python构建了一个小程序,我对打印用户单击“应用”时输入的值感兴趣。有什么办法让我做到这一点吗?然后我想使用另一段代码中的值在maya中创建建筑。在
def runGrid():
if mc.window('windowTest9', ex=True):
mc.deleteUI('windowTest9', window=True)
mc.window('windowTest9', title='BuilGen', sizeable=False, resizeToFitChildren=True)
mc.rowColumnLayout( numberOfColumns = 2, columnWidth = [ (1, 150), (2, 100), (3, 75)])
#mc.text( label = 'Top Bar')
mc.separator( h = 10, style = 'none')
mc.separator( h = 10, style = 'none')
mc.text(label='Create a New Building', align = 'left')
mc.image(image='F:\Photos\office-building-icon-687152.png')
# insert a blank line space
mc.separator( h = 10, style = 'singleDash')
mc.separator( h = 10, style = 'singleDash')
mc.text( label = 'number of sections wide:', align = 'left')
buildingWidth = mc.intField( value = 4)
mc.text( label = 'number of sections deep:', align = 'left')
buildingDepth = mc.intField( value = 3)
mc.text( label = 'number of floors:', align = 'left')
numberOfFloors = mc.intField( value = 2)
mc.text( label = 'roof:', align = 'left')
numberOfFloors = mc.checkBox (label='Y/N')
mc.separator( h = 10, style = 'none')
# insert another blank line
mc.separator( h = 10, style = 'none')
mc.separator( h = 10, style = 'none')
# create the buttons
mc.separator( h = 10, style = 'none')
mc.button( label = 'Apply', command = '' )
mc.button( label = 'Cancel', command = 'mc.deleteUI("windowTest9", window=True)')
mc.showWindow()
runGrid()
编辑:正如Weeny博士所说,最好参考其他类似的主题。
前段时间,我在我的博客上做了一个小小的提醒,为了能够测试所有不同的本地Maya UI命令使用方式,以及一种快速测试方法:
每种情况下还提供了将变量作为参数传递给这些函数的示例。因为有时候你必须有能力。 总的来说,我完全推荐使用functools.partial,它只提供了比其他的优势(如果您忘记了PySide)。在
Maya UI types
使用类时
因为它并不是为了使用类,所以当你在一个类中时,有些方法根本不起作用。在
^{pr2}$你可以在另一篇文章中看到答案:Printing the label of a button when clicked或者这里的措辞用法:Maya Python - Using data from UI
相关问题 更多 >
编程相关推荐