from PySide6.QtWidgets import QWidget, QApplication, QFileDialog from Ui_寻找空闲题号 import Ui_Form from database_tools_2 import * class MyWindow_kxth(QWidget,Ui_Form): def __init__(self,database_name): super().__init__() self.setupUi(self) self.bind() def bind(self): self.label_used.setText("") self.label_available.setText("") self.pushButton_exec.clicked.connect(self.exec) def exec(self): self.databaes_name = ReadTextFile("临时文件/databasename.txt").strip() self.label_used.setText(usedIDs(self.databaes_name)) self.label_available.setText(spareIDs(self.databaes_name)) print(self.databaes_name) if __name__ == '__main__': app = QApplication([]) windows = MyWindow() windows.show() app.exec()