Interface file Ui_ControlBoard.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Ui_ControlBoard.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): ("MainWindow") (800, 600) = (MainWindow) ("centralwidget") = () ((50, 180, 591, 171)) ("textBrowser") = () ((450, 390, 93, 28)) ("pushButton") () = (MainWindow) ((0, 0, 800, 26)) ("menubar") () = (MainWindow) ("statusbar") () (MainWindow) (MainWindow) def retranslateUi(self, MainWindow): _translate = (_translate("MainWindow", "MainWindow")) (_translate("MainWindow", "PushButton"))
Logic file Call_ControlBoard.py
version 1
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from PyQt5 import QtCore, QtGui import sys from import QEventLoop, QTimer from import QApplication, QMainWindow from Ui_ControlBoard import Ui_MainWindow class EmittingStr(): textWritten = (str) # Define a signal that sends str def write(self, text): (str(text)) class ControlBoard(QMainWindow, Ui_MainWindow): def __init__(self): super(ControlBoard, self).__init__() (self) # The following redirects the output to the textBrowser = EmittingStr(textWritten=) = EmittingStr(textWritten=) () def outputWritten(self, text): cursor = () () (text) (cursor) () def bClicked(self): """Runs the main function.""" print('Begin') loop = QEventLoop() (1000, ) loop.exec_() () loop = QEventLoop() (1000, ) loop.exec_() print("End") def printABCD(self): print("aaaaaaaaaaaaaaaa") print("bbbbbbbbbbbbbbbb") print("cccccccccccccccc") print("dddddddddddddddd") if __name__ == "__main__": app = QApplication() win = ControlBoard() () (app.exec_())
version 2
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from PyQt5 import QtCore, QtGui import sys from import QEventLoop, QTimer from import QApplication, QMainWindow from Ui_ControlBoard import Ui_MainWindow class EmittingStr(): textWritten = (str) # Define a signal that sends str def write(self, text): (str(text)) loop = QEventLoop() (1000, ) loop.exec_() class ControlBoard(QMainWindow, Ui_MainWindow): def __init__(self): super(ControlBoard, self).__init__() (self) # The following redirects the output to the textBrowser = EmittingStr(textWritten=) = EmittingStr(textWritten=) () def outputWritten(self, text): cursor = () () (text) (cursor) () def bClicked(self): """Runs the main function.""" print('Begin') () print("End") def printABCD(self): print("aaaaaaaaaaaaaaaa") print("bbbbbbbbbbbbbbbb") print("cccccccccccccccc") print("dddddddddddddddd") if __name__ == "__main__": app = QApplication() win = ControlBoard() () (app.exec_())
version 3
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from PyQt5 import QtCore, QtGui import sys from import QEventLoop, QTimer from import QApplication, QMainWindow from Ui_ControlBoard import Ui_MainWindow class EmittingStr(): textWritten = (str) # Define a signal that sends str def write(self, text): (str(text)) class ControlBoard(QMainWindow, Ui_MainWindow): def __init__(self): super(ControlBoard, self).__init__() (self) # The following redirects the output to the textBrowser = EmittingStr(textWritten=) = EmittingStr(textWritten=) () def outputWritten(self, text): cursor = () () (text) (cursor) () def bClicked(self): """Runs the main function.""" print('Begin') () print("End") def printABCD(self): print("aaaaaaaaaaaaaaaa") print("bbbbbbbbbbbbbbbb") print("cccccccccccccccc") print("dddddddddddddddd") if __name__ == "__main__": app = QApplication() win = ControlBoard() () (app.exec_())
Above this PYQT5 to realize the console display function is all I have shared with you, I hope to give you a reference, and I hope you support me more.