2

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.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
  • @Luke any help would be appreciated – Aakash Rajpal Jul 07 '15 at 06:16
  • Notifying people that are not already in this discussion doesn't work in StackOverflow, Aakash. I accidentially found this, not because you wrote my Name in your comment. If you need to discuss something, I strongly recommend the mailing list, discuss-gnuradio@gnu.org . You need to sign up under https://lists.gnu.org/mailman/listinfo/discuss-gnuradio , where you also find the archives. – Marcus Müller Jul 07 '15 at 20:55
  • hm, SWIG errors are notoriously hard to debug. There has been some work on PyQt-based visualizations, I really think it's best if you write an email with a subject like "Trying to do PyQt-based visualization with python top_block", and link to the full source code of your module as well as the full text of your error. – Marcus Müller Jul 07 '15 at 20:59

0 Answers0