Python Script (Putting Selections to TextField)


Hi. I’m new to python script. I’m currently making a tool window and there’s a part that I’m stuck on. I want mutiple selections to appear in the textfield as I press the button. However it is just the first selection that appears right now. The following is a part of my script I made :


import maya.cmds as cmds
import maya.mel as mel

window = cmds.window( widthHeight=(490, 485),title=“braid”)
def ygk_SurfaceSelect(*args):
sel =
add = cmds.textField(‘ygk_surfaceText’, edit=True, text=sel[0])

cmds.rowLayout( numberOfColumns=3, columnAttach=(1, ‘right’, 10), columnWidth=[(1,143),(2,245),(3,20)] )
ygk_textFld=cmds.textField(‘ygk_surfaceText’, width=240)
cmds.button(label=‘Assign Surface’, command=ygk_SurfaceSelect)


I know that it’s because of sel[0] in this line :

add = cmds.textField(‘ygk_surfaceText’, edit=True, text=sel[0])

I don’t know how to make this all selection instead. Please help