I am editing the top block for qt
in GNURadio. When I generate a qt
file, inside the top block I want to add a pyqtgraph GraphicsWindow
which is created by my Plot.py
block and is returned.
Here is the generated top_block.py
:
class top_block(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Top Block")
Qt.QWidget.__init__(self)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
Inside Plot.py
I created a pyqtgraphicsWindow
and returned the graphics window to top_block.py
as shown
class Plot(gr.sync_block):
def qtplot(self):
print "inside qtplot"
self.win = pg.GraphicsWindow()
return self.win
In top_block.py
I received and tried to add to top_layout
:
self.Plot_0 = gnuradio.input.Plot.Plot(1,1,1)
self._plot_win=self.Plot_0.qtplot()
self.top_layout.addWidget(self._plot_win)
However it is giving me a RuntimeError:
underlying C/C++ object has been deleted terminate called after throwing an instance of 'Swig::DirectorMethodException'
I tried to add a GraphicsWindow
directly in init
of topblock and it worked fine.