text: # QPlainText Widget 
  import sys
  from PyQt5.QtWidgets import *
  from PyQt5.QAxContainer import *
  
  
  class MyWindow(QMainWindow):
      def __init__(self):
          super().__init__()
          self.setGeometry(300, 300, 300, 300)
          self.setWindowTitle("실시간 자동매매")
  
          self.plain_text_edit = QPlainTextEdit(self)
          self.plain_text_edit.setReadOnly(True)
          self.plain_text_edit.move(10, 10)
          self.plain_text_edit.resize(280, 280)
  
          self.ocx = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
          self.ocx.OnEventConnect.connect(self._handler_login)
          self.CommConnect()
  
      def CommConnect(self):
          self.ocx.dynamicCall("CommConnect()")
  
      def _handler_login(self, err_code):
          if err_code == 0:
              self.plain_text_edit.appendPlainText("로그인 완료")
  
  
  if __name__ == "__main__":
      app = QApplication(sys.argv)
      window = MyWindow()
      window.show()
      app.exec_()