0

I am trying to call my function with changed text as parameter.

QtCore.QObject.connect(Ui().textEdit, QtCore.SIGNAL("textChanged()"), lambda mytext = Ui().textProfileDesc.toHtml(): self.myprint(mytext))

But it doesn't work, in mytext is the text before change.

def myprint(self, mytext):
    print "text1",mytext
    print "text2", Ui().textEdit.toHtml()

text1 - text before change, why??

text2 - changed text as expected

Meloun
  • 13,601
  • 17
  • 64
  • 93

1 Answers1

1

You connect the signal to textEdit but query the text from textProfileDesc.

Also, I think you don't really need lambda:

Ui().textEdit.textChanged.connect(self.myprint)
svlasov
  • 9,923
  • 2
  • 38
  • 39