title: how to copy the text from text edit into a string variable?
body: <p>i am trying to copy the text I enter into the text edit and store it into a string variable.
  I have written the following code but it shows 'python has stopped working'</p>
  
  <pre><code>from PyQt5 import QtGui,QtWidgets,QtCore
  import sys
  
  class GUI(QtWidgets.QWidget):
       def __init__(self):
          super(GUI,self).__init__()
          self.initUI()
      def initUI(self):
          review = QtWidgets.QLabel('Review')
          reviewEdit = QtWidgets.QTextEdit()
          grid = QtWidgets.QGridLayout()
  
          grid.addWidget(review, 3, 0)
          grid.addWidget(reviewEdit, 3, 1, 5, 1)
          self.setLayout(grid)
          self.setGeometry(300,300,350,300)
          self.setWindowTitle('Sentiment Analysis')
  
          button = QtWidgets.QPushButton("OK")         
          grid.addWidget(button)
          button.clicked.connect(self.copyText)
          self.show()
  
      def copyText(self):
          reviewEdit.setText("text")
          print(text)
  
  if __name__ == "__main__":
      app = QtWidgets.QApplication(sys.argv)
      GUI = GUI()
      sys.exit(app.exec_())
  </code></pre>