I don't think that you are going to be able and get the value using
'raw_input' in Maya.
What I would do is give the* textField* a name when creating it:
cmds.textField("nameOfTheTextField",enterCommand="doSomethingWithValue()",
w=100,h=17)
And then query it's value using something like this:
value=cmds.textField("nameOfTheTextField",query=True,text=True)
Personally, I would create a function that you execute when you press a
button (or press Enter from the textField) which queries the value and do
the rest of the work. By doing that, you keep the code separated which is
going to help to keep things clear.
Hope it helps
Dave
On Wed, Oct 24, 2012 at 11:39 AM, Daz <[email protected]> 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