title: Maya window adding a row dynamically with python
body: <p>I've been working on this for a while and I can't find any information about adding a row to a window. I seen it done with pyside2 and qt, witch would work but the users are using multiple versions of Maya (2016 = pyside, 2017=pyside2).</p>
  
  <p>I want it like adding a widget in in pyside. I done it where adding a row is a function like add row 1, add row 2, and add row 3 but the script get to long. I need to parent to <code>rowColumnLayout</code> and make that unique in order to delete that later. Also I have to query the textfield in each row. Maybe a <code>for</code> loop that adds a number to the row? I really don't know but this is what I have so far:</p>
  
  <p><a href="https://i.stack.imgur.com/AGNRp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AGNRp.png" alt="screenshot of widget"></a></p>
  
  <pre><code>from maya import cmds
  
  def row(  ):
      global fed
      global info
      item=cmds.optionMenu(mygroup, q=True, sl=True)
      if item == 1:
          cam=cmds.optionMenu(mygroup, q=True, v=True)
          fed=cmds.rowColumnLayout(nc = 1)
          cmds.rowLayout(nc=7)
          cmds.text(l= cam )
          cmds.text(l=u'Frame Range  ')
          start = cmds.textField('textField3')
          cmds.text(l=u' to ')
          finish = cmds.textField('textField2')
          cmds.button(l=u'render',c='renderTedd()')
          cmds.button(l=u'delete',c='deleteRow()')
          cmds.setParent (fed)
          def deleteRow ():
                  cmds.deleteUI(fed, layout=True)
      if item == 2:
          print item
          global red
          cam1=cmds.optionMenu(mygroup, q=True, v=True)
          red = cmds.rowColumnLayout()
          cmds.rowLayout(nc=7)
          cmds.text(l= cam1 )
          cmds.text(l=u'Frame Range  ')
          start = cmds.textField('textField3')
          cmds.text(l=u' to ')
          finish = cmds.textField('textField2')
          cmds.button(l=u'render',c='renderTedd()')
          cmds.button(l=u'delete',c='deleteRow2()')
          cmds.setParent (red)
  def deleteRow2 ():
      cmds.deleteUI(red, control=True)
  def cameraInfo():
      info=cmds.optionMenu(mygroup, q=True, sl=True)
      print info
  def deleteRow ():
      cmds.deleteUI(fed, control=True)
  def getCamera():
      layers=pm.ls(type="renderLayer")
      for layer in layers:
          pm.editRenderLayerGlobals(currentRenderLayer=layer)
          cameras=pm.ls(type='camera')
          for cam in cameras:
              if pm.getAttr(str(cam) + ".renderable"):
                  relatives=pm.listRelatives(cam, parent=1)
                  cam=relatives[0]
                  cmds.menuItem(p=mygroup,label=str (cam) )
  window = cmds.window()
  cmds.rowColumnLayout(nr=10)
  mygroup = cmds.optionMenu( label='Colors', changeCommand='cameraInfo()' )
  getCamera()
  cmds.button(l=u'create camera',aop=1,c='row ()')
  cmds.showWindow( window )
  </code></pre>