aboutsummaryrefslogtreecommitdiffstats
path: root/examples/charts
diff options
context:
space:
mode:
Diffstat (limited to 'examples/charts')
-rw-r--r--examples/charts/qmlpolarchart/qmlpolarchart.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/charts/qmlpolarchart/qmlpolarchart.py b/examples/charts/qmlpolarchart/qmlpolarchart.py
index 006a801f1..ca24fdc7a 100644
--- a/examples/charts/qmlpolarchart/qmlpolarchart.py
+++ b/examples/charts/qmlpolarchart/qmlpolarchart.py
@@ -40,8 +40,10 @@
"""PySide6 port of the QML Polar Chart Example from Qt v5.x"""
-import sys
import os
+from pathlib import Path
+import sys
+
from PySide6.QtQuick import QQuickView
from PySide6.QtCore import Qt, QUrl
from PySide6.QtWidgets import QApplication, QMainWindow
@@ -51,12 +53,12 @@ if __name__ == '__main__':
app = QApplication(sys.argv)
viewer = QQuickView()
- viewer.engine().addImportPath(os.path.dirname(__file__))
+ src_dir = Path(__file__).resolve().parent
+ viewer.engine().addImportPath(os.fspath(src_dir))
viewer.engine().quit.connect(viewer.close)
viewer.setTitle = "QML Polar Chart"
- qmlFile = os.path.join(os.path.dirname(__file__), 'main.qml')
- viewer.setSource(QUrl.fromLocalFile(os.path.abspath(qmlFile)))
+ viewer.setSource(QUrl.fromLocalFile(os.fspath(src_dir / 'main.qml')))
viewer.setResizeMode(QQuickView.SizeRootObjectToView)
viewer.show()