Hi Rudi, You're in the MelQt world because you used loadUI and loadUI is a MelQt command. So your always dealing with strings.
You can completely remove you Qt import lines as PyQt's from PyQt4 import QtGui from PyQt4.QtGui import * If you're interested PyQt's version of loadUI is in the uic module or in... from PyQt4.QtDesigner import QFormBuilder See the PyQt assistant for details. So, as you in MelQt work your'll need to use standard cmds to get,set the text. hint... MyTextField = "|YourMainWidgetName|AnyChildWidgetYouHave|txtFld_myLine" cmds.textField( MyTextField , q=True, text=True) ) -Dave On Wed, Aug 11, 2010 at 12:13 PM, rudi <[email protected]> wrote: > Hi, > are you sure?I am getting the error: > AttributeError: 'unicode' object has no attribute 'txtFld_myLine' > wich is understandable because it is not an attibute. > > > On 11 ago, 04:38, James <[email protected]> wrote: > > > I have named in Qt designer the QLineEdit as txtFld_myLine > > > Now I don“t know how to get the string that the user writes > > > there.Maybe I am looking at the wrong documentation. > > > Does it have something to do with QtGui.QInputDialog.getText? because > > > I tryed something like that without success > > > > > << > > > myText = QLineEdit("txtFld_myLine") > > > myName= QtGui.QInputDialog.getText() > > > > Hi, > > you're close and it's actually simpler than one would think... > > > > This is what you were doing before... and looks good to me: > > myWindow=loadUI (uiFile ='C:/Users/rudi/Desktop/t/test.ui') > > showWindow(myWindow) > > > > But, to get the value of a widget you've called, "txtFld_myLine", in > > the Qt Designer, you just need to call: > > > > lineText = myWindow.txtFld_myLine.text() > > > > I've not consulted the docs, so the method may be getText() as you > > have, in PyQt, as apposed to text(). > > > > Cheers, > > James. > > -- > http://groups.google.com/group/python_inside_maya > -- David Moulder http://www.google.com/profiles/squish3d -- http://groups.google.com/group/python_inside_maya
