qt模板

from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import *
from Ui_main import Ui_MainWindow

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *


import sys
class main_window(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        
        self.pushButton.released.connect(self.out)
        self.plainTextEdit_2.setPlainText(self.str_xxxx)

    def out(self):
        try:
            if("\n" in self.plainTextEdit_3.toPlainText() ):
                s3 = self.plainTextEdit_3.toPlainText().split("\n")
            else:
                s3 = self.plainTextEdit_3.toPlainText().split("")
            s2 = self.plainTextEdit_2.toPlainText().split("")
            s1 = list(set(s2).difference(set(s3)))
            print(s3,s2,s1)
            self.plainTextEdit.setPlainText(str(s1))
        except Exception as e:
            self.plainTextEdit.setPlainText(str(e))



if __name__ == "__main__":
    app = QApplication(sys.argv)
    MianWindow = main_window()
    MianWindow.show()
    sys.exit(app.exec_())

 

posted @ 2021-10-12 10:09  sunny开始学坏  阅读(224)  评论(0编辑  收藏  举报