Hi everyone,
I'm trying to update the text inside a TextItem object from a callback, so that I can stream float values that come from outside my python script.
The problem I'm facing is that once my callback is invoked from the framework I'm using, the following error is thrown:
QObject: Cannot create children for a parent that is in a different thread.
I don't know how to avoid that and I'm not sure if there is actually a way to do what I want,
This is the code I have written until now:
QtGui.QApplication([])
## Create window with GraphicsView widget
win = pg.GraphicsLayoutWidget()
win.show() ## show widget alone in its own window
win.setWindowTitle('...')
# ... window settings
## Create image item
self.vis = pg.ImageItem()
# ... image settings
## Create obstacle histogram
plot = pg.PlotItem()
# ... plot settings
self.text = pg.TextItem('Loading...')
self.view.addItem(self.text)
And from the callback mentioned above (where the problem is) I do:
self.text.setText('Hello world!')
Does anyone know how to avoid this problem and implement this behavior?
Thank you in advance for your answers, I hope the question is clear.