title: How to convert QTextedit's input to int in pyQt4 python
body: <p>I am fairly new to pyqt as i transitioned from tkinter. i want to simply ask for two numbers then click the button "SUM" to add both numbers and present the output on the gui but i keep getting errors like "cant convert str to int" or sometimes it outputs nothing at all. i feel i have to convert the input gotten from QTextedit to int or float but I've tried every possible way i know.  what am i missing?</p>
  
  <p>code is below</p>
  
  <pre><code>import sys
  from PyQt4 import QtCore, QtGui
  
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      def _fromUtf8(s):
          return s
  
  try:
      _encoding = QtGui.QApplication.UnicodeUTF8
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig, _encoding)
  except AttributeError:
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig)
  
  class Ui_Form(QtGui.QWidget):
      def __init__(self):
          QtGui.QWidget.__init__(self)
          self.setupUi(self)
          QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Plastique"))
      def setupUi(self, Form):
          Form.setObjectName(_fromUtf8("Form"))
          Form.resize(400, 300)
          self.sum_button = QtGui.QPushButton(Form)
          self.sum_button.setGeometry(QtCore.QRect(10, 20, 75, 23))
          self.sum_button.setObjectName(_fromUtf8("sum_button"))
          self.sum_button.clicked.connect(self.action)
  
          self.text1 = QtGui.QTextEdit(Form)
          self.text1.setGeometry(QtCore.QRect(110, 10, 104, 71))
          self.text1.setObjectName(_fromUtf8("text1"))
          self.texxt1 = self.text1.toPlainText()
  
          self.text2 = QtGui.QTextEdit(Form)
          self.text2.setGeometry(QtCore.QRect(110, 140, 104, 71))
          self.text2.setObjectName(_fromUtf8("text2"))
          self.texxt2 = self.text2.toPlainText()
  
          self.clear = QtGui.QPushButton(Form)
          self.clear.setGeometry(QtCore.QRect(20, 140, 75, 23))
          self.clear.setObjectName(_fromUtf8("clear"))
  
          self.retranslateUi(Form)
          QtCore.QObject.connect(self.clear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.text2.clear)
          QtCore.QObject.connect(self.clear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.text1.clear)
          QtCore.QMetaObject.connectSlotsByName(Form)
  
      def action(self):
          self.tex = self.texxt1
          self.ij = self.texxt2
          self.l = self.tex + self.ij
          QtGui.QLabel(self.l,self)
  
      def retranslateUi(self, Form):
          Form.setWindowTitle(_translate("Form", "Form", None))
          self.sum_button.setText(_translate("Form", "sum", None))
          self.clear.setText(_translate("Form", "clear", None))
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      ex = Ui_Form()
      ex.show()
      sys.exit(app.exec_())
  </code></pre>