import sys from PyQt5.QtWidgets import QApplication from qfluentwidgets import FluentWindow, Theme, setTheme from qfluentwidgets import FluentIcon as FIF from interface.main import MainWidget from interface.setting import SettingWidget class MainWindow(FluentWindow): def __init__(self): super().__init__() self.setWindowTitle("HoYoCenter") setTheme(Theme.DARK) self.id2obj = { "主页": [MainWidget(), FIF.HOME], "设置": [SettingWidget(), FIF.SETTING] } self.init_ui() def init_ui(self): self.init_menu() def init_menu(self): self.navigationInterface.setExpandWidth(150) for name, obj in self.id2obj.items(): obj[0].setObjectName(name) self.addSubInterface(obj[0], obj[1], name) def create_app(): app = QApplication(sys.argv) window = MainWindow() window.show() return app def main(): app = create_app() sys.exit(app.exec_()) if __name__ == '__main__': main()