|
Hi,
I have a problem reading the content of lineEdits from an UI.
I have created an UI with QTDesigner with one lineEdit named “myTextField” and one button.
I gave the button the dynamic attribute to run the doIt() function.
import pymel # load QT user-interface and show it dialog = pm.loadUI(f='C:\\work\\vnxMaya\\src\\input.ui') pm.showWindow(dialog)
def doIt():
myT = myT = mc.textField('myTextField', query=True, text=True)
print myT
Now sometime it works and prints the right values that are in the lineEdit-field and if I change the text in the lineEdit it will update correctly.
But most of the time it will print an empty string (’’) and even writing sth different into the lineEdit-field as default or interactive wonn’t change the output. I wrote the same code with mel and python (without pymel) and the results are the same.
Any ideas, why the myT variable doesn’t update?
|
|
|
|
just wondering, why do you declare the variable in itself twice?
myT = myT = mc.textField('myTextField', query=True, text=True)
Lee Dunham | Character TD
ldunham.blogspot.com
|
|
|
|
why do you have myT twice? and also, how do you declare your event linking in qt designer? personnally i prefer just defining the names in qt and have a function called _defineCallbacks() in my python code to do something like
cmds.button("myButton", edit = True, command = self.doIt)
|
|
|