Or you can simply use pymel:

---————––------
from pymel.all import *
.
.
Myfield = textField()
.
.
Data = textField.getText()
----––———–––--

Sent from my iPad

On Oct 24, 2012, at 3:12 PM, Ali Khanbabaei <[email protected]> wrote:

> #use this script.i change it a little
> import maya.cmds as cmds
> if cmds.window('a',exists=True):
>    cmds.deleteUI('a')
> 
> def selection(*args):
>   selectionName = cmds.textField('TFL_selection',q=True,text=True)
>   cmds.select(selectionName)
> 
> cmds.window('a', title='test', w=300, h=100,mnb=False, mxb=False)
> cmds.showWindow('a')
> 
> mainLayout = cmds.flowLayout()
> 
> cmds.text('test ')
> cmds.textField('TFL_selection',enterCommand=selection, w=100,h=17)
> 
> On Wednesday, October 24, 2012 2:56:13 PM UTC+3:30, Daz wrote:
> Heya
> 
> Humh... well it does not really work the way I thought it would work... once 
> I press the tiny enter I get a python request input window pop up. I dont 
> want that to happen. I just want it to search using preferably * * names. Not 
> sure I think I can just type *sph* instead of pSphere1 but still the second 
> pop up windows is unwanted... Is there a way to remove it?
> 
> Thanks, bya. 
> 
> 
> On Wednesday, 24 October 2012 12:13:43 UTC+1, Ali Khanbabaei wrote:
> your script is true.Note that in maya enter command is right Enter Button in 
> your keyboard
> 
> On Wednesday, October 24, 2012 2:09:14 PM UTC+3:30, Daz wrote:
> Heya
> 
> One of my ancient enemies since I'm learning python are text fields... I just 
> cant figure out how to get them to work arrr. I want to be able to type in a 
> name and then use it with my functions, when ever I want to select objects, 
> create an object with that text and so on... I got that far but I'm still 
> hitting a wall with it atm wrrr... if any1 could give me a hint as to where I 
> go wrong it would be great !
> 
> 
> if cmds.window('a',exists=True):
> cmds.deleteUI('a')
> cmds.window('a', title='test', w=300, h=100,mnb=False, mxb=False)
> cmds.showWindow('a')
> 
> mainLayout = cmds.flowLayout()
> 
> cmds.text('test ')
> cmds.textField(enterCommand=('cmds.select(raw_input(""))'), w=100,h=17)
> 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to