if __name__ == "__main__": from sys import argv, exit from os.path import abspath, join, dirname out: QApplication = QApplication(argv) imagen = abspath( join(dirname(__file__), 'config', 'ventana_principal', 'assets', 'fondo.png')) ventana = QWidget() pantalla_de_carga = QSplashScreen(ventana, imagen) pantalla_de_carga.show() from PySide2.QtCore import Qt pantalla_de_carga.setFont(QFont('Segoe Ui SemiBold', 15)) pantalla_de_carga.showMessage( "Cargando...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) state: State = State() pantalla_de_carga.showMessage( "Cargando fuentes...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) fuentes: List[str] = cargar_fuentes() pantalla_de_carga.showMessage( "Iniciando Aplicación...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) clase: App = App(fuentes, state)
self.working = False # 工作状态标志量 def run(self): # 进行线程任务 while self.working: sleep(0.1) self.signal.emit() # 发射信号 if __name__ == '__main__': # 创建一个应用程序对象 app = QApplication(sys.argv) splash = QSplashScreen(QPixmap("resource/images/loading.png")) splash.showMessage("加载中,请稍后...", Qt.AlignHCenter | Qt.AlignBottom, Qt.cyan) splash.setFont(QFont("华文楷体", 10, QFont.Bold)) splash.show() # 显示启动界面 QApplication.processEvents() # 处理主进程事件 # 创建控件(容器) window = MyWindow() # 设置标题 # window.setWindowTitle('title') # window.load_data(splash) # 加载数据 # 显示窗口 window.show() splash.finish(window) # 隐藏启动界面 # 进入消息循环 sys.exit(app.exec_())