PySide6.QtGraphs.QSurfaceDataProxy.resetArrayNp called with wrong argument types:
-
I am attempting to migrate a surface graph in a python App from Pyqtgraph/PyQt5 to pyside6/QtGraphs.
pyside 6.9.3
python 3.14This simple test code (qsurfacedataproxy and qsurface3dseries imported from pyside6 QtGraphs and defined):
arry = np.array([[1.0, 2.0, 3.0],[4.0, 5.0, 6.0],[7.0, 8.0, 9.0]]) self._dataProxy.resetArrayNp(0.0, 1.0, 0.0, 1.0, arry)I get the errors below. I cannot see what I am doing wrong, is this a bug in the new QtGraphs module?
FIXME qt_isinstance([[1. 2. 3.]
[4. 5. 6.]
[7. 8. 9.]], collections.abc.Sequence[typing.Any]): isinstance() argument 2 cannot be a parameterized generic"and
TypeError: 'PySide6.QtGraphs.QSurfaceDataProxy.resetArrayNp' called with wrong argument types:
PySide6.QtGraphs.QSurfaceDataProxy.resetArrayNp(float, float, float, float, ndarray)
Supported signatures:
PySide6.QtGraphs.QSurfaceDataProxy.resetArrayNp(x: float, deltaX: float, z: float, deltaZ: float, data: collections.abc.Sequence[typing.Any], /)I have tried everything I can think of to make it work and simplified my previous code to the test example ablove.
-
Hi and welcome to devnet,
Can you provide a minimal runnable script that shows this issue ?
Did you also try with a more recent version of PySide6 ? -
No, I haven't tried a more recent version of PySide6 as it's not available in conda-forge that I used for my env.
Copyright (C) 2023 The Qt Company Ltd.
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from future import annotations
import sys
import numpy as np
from PySide6.QtCore import QSize
from PySide6.QtGraphs import QSurface3DSeries
from PySide6.QtGraphsWidgets import Q3DSurfaceWidgetItem
from PySide6.QtQuickWidgets import QQuickWidget
from PySide6.QtWidgets import QApplication
"""Based on the Minimal Qt Graphs Surface Example"""if name == 'main':
app = QApplication(sys.argv)window = QQuickWidget() surface = Q3DSurfaceWidgetItem() surface.setWidget(window) axis = surface.axisX() axis.setTitle("X") axis.setTitleVisible(True) axis = surface.axisY() axis.setTitle("Y") axis.setTitleVisible(True) axis = surface.axisZ() axis.setTitle("Z") axis.setTitleVisible(True) data = np.array([[0, 1], [0, 2], [1, 3], [1, 4]]) series = QSurface3DSeries() series.dataProxy().resetArrayNp(0.0, 1.0, 0.0, 1.0, data) surface.addSeries(series) available_height = app.primaryScreen().availableGeometry().height() width = available_height * 4 / 5 window.resize(QSize(width, width)) window.show() exit_code = app.exec() surface = None del window sys.exit(exit_code) -
The example works fine using a standard PySide6 package (pip install PySide6-Addons). This probably means that Conda builds PySide6 without numpy support.
-
The example works fine using a standard PySide6 package (pip install PySide6-Addons). This probably means that Conda builds PySide6 without numpy support.
@friedemannkleint thank you, I will investigate
-
I created another environment using venv instead, and the test code works. I didn't realise that there could be problems like that using conda environments, I thought that I was making a "wholesome" system to work in. Every day is a school day, even at 65 years old. Thanks again for the help.
-
G G4IXT has marked this topic as solved on
-
I created another environment using venv instead, and the test code works. I didn't realise that there could be problems like that using conda environments, I thought that I was making a "wholesome" system to work in. Every day is a school day, even at 65 years old. Thanks again for the help.