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.database_name = database_name 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.database_name)) self.label_available.setText(spareIDs(self.database_name)) def setdbname(self,string): self.database_name = string # print(self.database_name) if __name__ == '__main__': app = QApplication([]) windows = MyWindow() windows.show() app.exec()