From a0576de0804861a8c69472f012a77c0db916dbc6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 Apr 2022 09:10:55 +0200 Subject: Surface example: Fix loading the image from a different path Use Pathlib to locate the image file. Task-number: PYSIDE-1880 Pick-to: 6.2 6.3 Change-Id: Idc1c0b6dc3fb1f62edd63e4c6eb61c7d4940387c Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Shyamnath Premnadh --- examples/datavisualization/surface/surfacegraph.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/datavisualization/surface/surfacegraph.py b/examples/datavisualization/surface/surfacegraph.py index 3cc571a37..a6a211b2e 100644 --- a/examples/datavisualization/surface/surfacegraph.py +++ b/examples/datavisualization/surface/surfacegraph.py @@ -39,6 +39,7 @@ ############################################################################# import math +from pathlib import Path from PySide6.QtCore import QObject, Qt, Slot from PySide6.QtDataVisualization import (Q3DTheme, QAbstract3DGraph, @@ -69,7 +70,8 @@ class SurfaceGraph(QObject): self.m_sqrtSinSeries = QSurface3DSeries(self.m_sqrtSinProxy) self.fillSqrtSinProxy() - heightMapImage = QImage("mountain.png") + imageFile = Path(__file__).parent / "mountain.png" + heightMapImage = QImage(imageFile) self.m_heightMapProxy = QHeightMapSurfaceDataProxy(heightMapImage) self.m_heightMapSeries = QSurface3DSeries(self.m_heightMapProxy) self.m_heightMapSeries.setItemLabelFormat("(@xLabel, @zLabel): @yLabel") -- cgit v1.2.3