#!/usr/bin/python # This Python file uses the following encoding: utf-8 import sys import os from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine from PySide6 import QtCore, QtWidgets # created from /usr/lib/qt6/rcc -g python qml.qrc -o resources.py # converts the resources to bytes and can be called from qrc:/some/file.jpg import resources if __name__ == "__main__": QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts) app = QGuiApplication(sys.argv) app.setApplicationName("WeatherWidget") app.setOrganizationName("AllspiceInc") app.setOrganizationDomain("AllspiceInc") engine = QQmlApplicationEngine() engine.load(QtCore.QUrl("main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())
""" import os import sys import platform from PySide6.QtGui import QGuiApplication, QIcon from PySide6.QtCore import QSettings, QUrl from PySide6.QtQml import QQmlApplicationEngine, QQmlContext from PySide6.QtQuickControls2 import QQuickStyle import rc_gallery if __name__ == "__main__": QGuiApplication.setApplicationName("Gallery") QGuiApplication.setOrganizationName("QtProject") app = QGuiApplication() QIcon.setThemeName("gallery") settings = QSettings() if not os.environ.get("QT_QUICK_CONTROLS_STYLE"): QQuickStyle.setStyle(settings.value("style", str)) engine = QQmlApplicationEngine() built_in_styles = ["Basic", "Fusion", "Imagine", "Material", "Universal"] if platform.system() == "Darwin": built_in_styles.append("macOS") elif platform.system() == "Windows": built_in_styles.append("Windows")