title: Python - PyQT5 print output inside the QTextEdit
body: <p>I have a pyqt5 code to print the dictionary output inside the QTextEdit</p>
  
  <pre><code>#code:-
  from PyQt5 import QtCore, QtGui, QtWidgets
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(565, 600)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.text_output = QtWidgets.QTextEdit(self.centralwidget)
          self.text_output.setGeometry(QtCore.QRect(20, 10, 501, 251))
          self.text_output.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
          self.text_output.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
          self.text_output.setObjectName("text_output")
          self.btn_dict = QtWidgets.QPushButton(self.centralwidget)
          self.btn_dict.setGeometry(QtCore.QRect(30, 280, 101, 21))
          self.btn_dict.setObjectName("btn_dict")
          self.btn_clear = QtWidgets.QPushButton(self.centralwidget)
          self.btn_clear.setGeometry(QtCore.QRect(180, 280, 101, 21))
          self.btn_clear.setObjectName("btn_clear")
          self.btn_exit = QtWidgets.QPushButton(self.centralwidget)
          self.btn_exit.setGeometry(QtCore.QRect(310, 280, 101, 21))
          self.btn_exit.setObjectName("btn_exit")
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 565, 21))
          self.menubar.setObjectName("menubar")
          MainWindow.setMenuBar(self.menubar)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
          self.btn_dict.setText(_translate("MainWindow", "PrintDictionary"))
          self.btn_clear.setText(_translate("MainWindow", "Clear"))
          self.btn_exit.setText(_translate("MainWindow", "Exit"))
  
      def dictionary(self):
          new_dict = {
                'Name' : 'Ron',
                'Age' : '21',
                'city' : 'NY'
  }
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      MainWindow = QtWidgets.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>So instead of printing output on console , i want to the output inside QTextEdit when clicked on PrintDictionary button as well as how to clear QTextEdit when clicked on clear button or exit application when clicked on exit button</p>
  
  <p>I'm new to PYQT5 so please help me out.
  Thanks</p>