Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 从QBufferDataGenerator继承_Python 3.x_Opengl_Qt5_Pyqt5_Qt3d - Fatal编程技术网

Python 3.x 从QBufferDataGenerator继承

Python 3.x 从QBufferDataGenerator继承,python-3.x,opengl,qt5,pyqt5,qt3d,Python 3.x,Opengl,Qt5,Pyqt5,Qt3d,首先,我的设置: 蟒蛇3 requirements.txt PyQt5>=5.12 pyqt3d>=5.12 pyopengl 示例.py from PyQt5.QtCore import * from PyQt5.Qt3DCore import * from PyQt5.Qt3DRender import * class SomeDataGenerator(QBufferDataGenerator): def __init__(self, some_bytes):

首先,我的设置:

蟒蛇3

requirements.txt

PyQt5>=5.12
pyqt3d>=5.12
pyopengl
示例.py

from PyQt5.QtCore import *
from PyQt5.Qt3DCore import *
from PyQt5.Qt3DRender import *

class SomeDataGenerator(QBufferDataGenerator):
    def __init__(self, some_bytes):
        super().__init__()
        self._bytes = some_bytes

    def __call__(self):
        return self._bytes

    def __eq__(self, other):
        return (self._bytes == other._bytes)

    def __neq__(self, other):
        return not (self._bytes == other._bytes)

    def id(self):
        return functorTypeId(SomeDataGenerator)


someBytes = QByteArray()
someBuffer = QBuffer(QBuffer.VertexBuffer)
someDataGenerator = SomeDataGenerator(someBytes)
someBuffer.setDataGenerator(someDataGenerator)

并在运行时输出:

$ python3 example.py
...
TypeError: PyQt5.Qt3DRender.QBufferDataGenerator cannot be instantiated or sub-classed
所以问题是如何调用
QBuffer::setDataGenerator


我想做的一件大事是:通过
PyQt5
绑定使用
Qt3D
绘制点或任何东西。

似乎是一个非常明显的错误,因为它是专门设计为子类的。在上报告它。@ekhumoro,你有什么想法吗?我如何解决这个问题?显然,通过使用。似乎是一个非常明显的错误,因为它是专门设计为子类的。你知道我该如何解决这个问题吗?显然是通过使用。