我在Maya Python中有一个tablayout
。我试图在每次浏览选项卡时显示一个随机数。在下面我不知道如何刷新标签
import maya.cmds as cmds
cmds.window( widthHeight=(200, 150) )
form = cmds.formLayout()
tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
cmds.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
child1 = cmds.rowColumnLayout(numberOfColumns=2)
num1 = random.randint(1,100001)
cmds.text(num1)
cmds.setParent( '..' )
child2 = cmds.rowColumnLayout(numberOfColumns=2)
num2 = random.randint(1,100001)
cmds.text(num2)
cmds.setParent( '..' )
cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'), (child2, 'Two')) )
cmds.showWindow()
我已经修改了你的代码使其正常工作:
相关问题 更多 >
编程相关推荐