diff options
Diffstat (limited to 'examples/declarative/extending/chapter1-basics')
-rw-r--r-- | examples/declarative/extending/chapter1-basics/basics.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py index 5e2614fc7..9cbead9cc 100644 --- a/examples/declarative/extending/chapter1-basics/basics.py +++ b/examples/declarative/extending/chapter1-basics/basics.py @@ -42,6 +42,7 @@ """PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x""" import os +from pathlib import Path import sys from PySide6.QtCore import Property, Signal, Qt, QUrl @@ -88,8 +89,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.SizeRootObjectToView) - qmlFile = os.path.join(os.path.dirname(__file__), 'app.qml') - view.setSource(QUrl.fromLocalFile(os.path.abspath(qmlFile))) + qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') + view.setSource(QUrl.fromLocalFile(qml_file)) if view.status() == QQuickView.Error: sys.exit(-1) view.show() |