title: Creating a UI in maya using python scripting
body: <p>I am creating a custom UI inside maya using python and I'm stuck on this error that occurs on this line:</p>
  
  <pre><code>parts = button2.split(",") # NameError: global name 'button2' is not defined 
  </code></pre>
  
  <p>Here is my script:</p>
  
  <pre><code>import maya.cmds as cmds
  
  def createMyLayout():
      window = cmds.window(widthHeight=(1000, 600), title="lalala",   resizeToFitChildren=1)
      cmds.rowLayout("button1, button2, button3", numberOfColumns=5)
  
      cmds.columnLayout(adjustableColumn=True, columnAlign="center", rowSpacing=10)
  
      button2 = cmds.textFieldButtonGrp(label="LocatorCurve",
                                      text="Please key in your coordinates",
                                      changeCommand=edit_curve,
                                      buttonLabel="Execute",
                                      buttonCommand=locator_curve)
      cmds.setParent(menu=True)
  
      cmds.showWindow(window)
  
  def locator_curve(*args):
      # Coordinates of the locator-shaped curve.
      crv = cmds.curve(degree=1,
                   point=[(1, 0, 0),
                          (-1, 0, 0),
                          (0, 0, 0),
                          (0, 1, 0),
                          (0, -1, 0),
                          (0, 0, 0),
                          (0, 0, 1),
                          (0, 0, -1),
                          (0, 0, 0)])
  
  
      return crv
  
  def edit_curve(*args):
      parts = button2.split(",")
      print parts
  
  
  createMyLayout()    
  </code></pre>
  
  <p>Basically my script is trying to create a UI with buttons inside that do stuff. In this case, I am trying to create a textfield button which the user keys in a set of coordinates and the locator based curve is created according to the set of coordinates given. However, I could only manage to create a button that creates a default curve. Can some one tell me how to go about creating a button that takes into consideration what coordinates a person gives and outputs the specific curve? </p>