This is a continuation of this question. I understand that calling a plotting function from a block thread is problematic because it might conflict with the WX Gui thread.
Can anyone show me a very simple code snippet which plots the value of input_items
using an existing visualizer instead of plotting it inside the block thread?
Here is an outline of the GNU Radio sync_block which receives the values to be plotted in input_items
:
import numpy
from gnuradio import gr
class xyz(gr.sync_block):
def __init__(self, multiple):
gr.sync_block.__init__(self,
name="xyz",
in_sig=[<+numpy.float+>],
out_sig=[<+numpy.float+>])
def work(self, input_items, output_items):
in0 = input_items[0]
out = output_items[0]
.....
# How to pass the value of input_items to an existing visualizer which plots a graph based on these values on the GUI
.....
out[:] = in0
return len(output_items[0])
Also which existing plot block(in gnuradio/gr-wxgui) is suggested to be used as a reference for this?