【发布时间】:2020-01-05 20:33:42
【问题描述】:
当我按下他们的按钮时,我正在尝试找到一种更好的方法来更改多个textFieldButtongGrps 中的textfield。
目前,我在这里的工作有效,但有了这个,我必须在 select_Object() 中添加额外的行,以便在我的 UI 中添加任何额外的 textFieldButtongGrps。这是因为我必须在select_Object()中声明名称
有没有办法改变这一点,如果我制作 6 个 textFieldButtongGrps,我可以让 select_Object() 函数使用类似于 self 的东西?
import maya.cmds as cmds
window = cmds.window()
cmds.columnLayout()
tsL0 =cmds.textFieldButtonGrp(ed=False, adj=1,cal=(1,"left"),cw3=(10,100,25), cl3=("left","left","left") ,
buttonLabel='Root FK',bc = 'select_Object()' )
gtF0 = tsL0
tsL1 =cmds.textFieldButtonGrp(ed=False, adj=1,cal=(1,"left"),cw3=(10,100,25), cl3=("left","left","left") ,
buttonLabel='Root FK',bc = 'select_Object()' )
gtF1 = tsL1
cmds.showWindow( window )
def select_Object():
cmds.textFieldButtonGrp(**gtF0**, edit = True, tx ='' .join(sel),buttonLabel='IK OK',backgroundColor = (.5,.8,.2))
我想要达到的目标:
def select_Object():
cmds.textFieldButtonGrp(**self**, edit = True, tx ='' .join(sel),buttonLabel='IK OK',backgroundColor = (.5,.8,.2))
【问题讨论】:
-
请记住,您不应将字符串用于 ui 命令。 bc = select_Object 如果没有参数就足够了,如果有参数,使用 partial 或 lambda
标签: python user-interface maya