Hi,
I am running a plot in an Application where I add data regularly. After a
certain time I get the following error:
Traceback (most recent call last):
File
"D:\Programs\Miniconda3\envs\FreezingQtApp\lib\site-packages\pyqtgraph\graphicsItems\ViewBox\ViewBox.py"
, line 75, in boundingRect
return self.mapRectFromParent(self.parentItem().boundingRect())
RuntimeError: Internal C++ object (ChildGroup) already deleted.
Traceback (most recent call last):
File "C:/Users/xxxx/.PyCharm2019.2/config/scratches/scratch.py", line 27,
in run
self.plotdata.setData(data)
File
"D:\Programs\Miniconda3\envs\FreezingQtApp\lib\site-packages\pyqtgraph\graphicsItems\PlotDataItem.py"
, line 466, in setData
self.updateItems()
File
"D:\Programs\Miniconda3\envs\FreezingQtApp\lib\site-packages\pyqtgraph\graphicsItems\PlotDataItem.py"
, line 492, in updateItems
self.curve.setData(x=x, y=y, **curveArgs)
File
"D:\Programs\Miniconda3\envs\FreezingQtApp\lib\site-packages\pyqtgraph\graphicsItems\PlotCurveItem.py"
, line 335, in setData
self.updateData(*args, **kargs)
File
"D:\Programs\Miniconda3\envs\FreezingQtApp\lib\site-packages\pyqtgraph\graphicsItems\PlotCurveItem.py"
, line 369, in updateData
self.prepareGeometryChange()
RuntimeError: Internal C++ object (PlotCurveItem) already deleted.
I've broken the code down to the minimal example:
import sys
import time
from PySide2 import QtGui, QtCore
import pyqtgraph as pg
import numpy as np
from PySide2.QtCore import QThread
app = QtGui.QApplication([])
w = pg.PlotWidget()
class Worker(QThread):
def __init__(self, plotdata: pg.PlotDataItem):
QThread.__init__(self)
self.plotdata = plotdata
self.raw_data = []
def run(self):
for i in range(1, 10001):
newdata = np.random.normal(loc=10,scale=2)
self.raw_data.append((time.time(),newdata))
data = np.array(self.raw_data)
self.plotdata.setData(data)
time.sleep(0.01)
plotdata = w.plot(x=[],y=[])
w.show()
worker = Worker(plotdata)
worker.start()
sys.exit(app.exec_())
I just don't know where I could have released an object that is now being
deleted by the gc.
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/3ed5bb5c-bbb7-4c5d-b305-174075be7608%40googlegroups.com.