Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Maya python脚本gui中未获得预期输出_Python_User Interface_Maya - Fatal编程技术网

在Maya python脚本gui中未获得预期输出

在Maya python脚本gui中未获得预期输出,python,user-interface,maya,Python,User Interface,Maya,我正在使用python脚本在maya中制作gui,但没有得到预期的输出 我想在选项卡布局外显示Submit按钮,但我做错了。有人能纠正我吗 在第一个文本字段的末尾,我想添加一个按钮选择,就像在预期输出中添加的一样 代码: import maya.cmds as cmds # Make a new window window = cmds.window( title="Render", iconName='BTD', widthHeight= (400,500),titleBar=True,m

我正在使用python脚本在maya中制作gui,但没有得到预期的输出

我想在选项卡布局外显示
Submit按钮
,但我做错了。有人能纠正我吗

在第一个文本字段的末尾,我想添加一个按钮
选择
,就像在预期输出中添加的一样

代码:

import maya.cmds as cmds

# Make a new window

window = cmds.window( title="Render", iconName='BTD', widthHeight=
(400,500),titleBar=True,minimizeButton=True,maximizeButton=True )
cmds.columnLayout( adjustableColumn=True)

form = cmds.formLayout()
tabs = cmds.tabLayout(innerMarginWidth=10, innerMarginHeight=10)
cmds.formLayout(form,edit=True,attachForm=((tabs, 'top', 0), (tabs, 'left', 
0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
child1 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='1')
cmds.button(label='2')
cmds.button(label='3')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.setParent( '..' )


child2 = cmds.rowColumnLayout(numberOfColumns=1,columnOffset = 
(1,'left',10))
#cmds.text("Output Directory",width = 50,height=50,font = "boldLabelFont")
cmds.text("Output Directory",width=200, height=50,font="boldLabelFont", 
align='left')
name = cmds.textField(w = 300,h = 20)

cmds.text("Notify on job completion",width = 200,height=50,font = 
"boldLabelFont",align='left')
name = cmds.textField(w = 370,h = 20)




cmds.setParent( '..' )


child3 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='7')


cmds.button(label='8')
cmds.button(label='9')
cmds.setParent( '..' )

cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'General'), (child2, 
'Advanced'),(child3, 'Job Software')) )
cmds.setParent( '..' )


#cmds.setParent( '..' )   
cmds.button("Submit Job",width=100, height=50, align='right') 

cmds.showWindow( window )
输出

预期产出


我没有使用setParent命令,这对我来说太混乱了, 我已通过在:
表单和cmds.button(“提交作业…”)中添加父标志纠正了您的问题。
大多数时候我只使用列和行布局

import maya.cmds as cmds

# Make a new window

window = cmds.window( title="Render", iconName='BTD', widthHeight=
(400,500),titleBar=True,minimizeButton=True,maximizeButton=True )
cmds.columnLayout( adjustableColumn=True)

columnMain = cmds.columnLayout() # <<================================
form = cmds.formLayout(p=columnMain)
tabs = cmds.tabLayout(innerMarginWidth=10, innerMarginHeight=10)
cmds.formLayout(form,edit=True,attachForm=((tabs, 'top', 0), (tabs, 'left', 
0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
child1 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='1')
cmds.button(label='2')
cmds.button(label='3')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.button(label='9')
cmds.setParent( '..' )


child2 = cmds.rowColumnLayout(numberOfColumns=1,columnOffset = 
(1,'left',10))
#cmds.text("Output Directory",width = 50,height=50,font = "boldLabelFont")
cmds.text("Output Directory",width=200, height=50,font="boldLabelFont", 
align='left')
name = cmds.textField(w = 300,h = 20)

cmds.text("Notify on job completion",width = 200,height=50,font = 
"boldLabelFont",align='left')
name = cmds.textField(w = 370,h = 20)




cmds.setParent( '..' )


child3 = cmds.rowColumnLayout(numberOfColumns=2)
cmds.button(label='7')


cmds.button(label='8')
cmds.button(label='9')
cmds.setParent( '..' )

cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'General'), (child2, 
'Advanced'),(child3, 'Job Software')) )
cmds.setParent( '..' )


#cmds.setParent( '..' )   
cmds.button("Submit Job",width=100, height=50, align='right', p=columnMain) # <<================================

cmds.showWindow( window )

你能用注释解释一下这个代码吗?我是新来的,真的很困惑谁是谁的父母,谢谢你的回答我贴了一个例子
import maya.cmds as cmds

# Make a new window

window = cmds.window( title="Render", iconName='BTD', widthHeight=(400,500),titleBar=True,minimizeButton=True,maximizeButton=True )

# 1.0
columnMain = cmds.columnLayout() # the cyan rectangle

# 1.1 : First WIDGET : Conductor refresh - light green

conductorLayout = cmds.rowLayout(numberOfColumns=2, p=columnMain)
cmds.button(label='image', width=350, p=conductorLayout)
cmds.button(label='refresh', p=conductorLayout)


#1.2 : Second WIDGET : tab widget - in red
form = cmds.formLayout(p=columnMain)
tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5, p=form)

#     1.2.1 : first tab widget - blue color
child1 = cmds.columnLayout(p=tabs)
#         1.2.1.2 : the green one with image picker
cmds.button(p=child1)
pickpath = cmds.rowLayout(numberOfColumns=2, p=child1)
name = cmds.textField(w = 370,h = 20, p=pickpath)
cmds.button( label='Submit Job',width=130,align='right', p=pickpath)
cmds.button(p=child1)

#     1.2.2 : second tab widget - blue Color

child2 = cmds.rowColumnLayout(numberOfColumns=2,p=tabs)
cmds.button(p=child2)
cmds.button(p=child2)


cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'),(child2, 'Two')))

#1.3 Pink
submit_widget = cmds.rowLayout(numberOfColumns=2, p=columnMain)
cmds.checkBox(label='Scout Job', p=submit_widget)
cmds.button( label='Submit Job',width=130,align='right', p=submit_widget)
cmds.showWindow()