title: Python Text Field in Maya
body: <p>I was wondering how I would be able to go about getting the text in a textfield to be passed into the Focus Distance attribute of a camera in Maya?</p>
  
  <p>I've been working on it so far and the method I have setup is that a command will be run when enter is hit within the textfield, from there is finds the selected camera and tries to query the text inside of the textfield.</p>
  
  <pre><code>cmds.textField("focusdistance", parent="Extra", enterCommand=focusdistance)
  </code></pre>
  
  <p>Once you hit enter it will run:</p>
  
  <pre><code>def focusdistance(self):
      fd = cmds.ls(sl=True)[0]
      cmds.setAttr('query="focusdistacne.tx"')
  </code></pre>
  
  <p>I've got it up and running, but I also keep getting and error from Maya:</p>
  
  <pre><code># Error: RuntimeError: file &lt;maya console&gt; line 85: setAttr: Invalid object name: query="focusdistacne.tx" # 
  </code></pre>
  
  <p>So to simplify. I have a textfield that is editable and can run a command when enter is hit. When enter is hit I would like for the numbers entered in the textfield to be passed into the focus distance attribute of a selected camera in Maya.</p>
  
  <p>Thank you!</p>