Python Hier block using callback

Hi all;

I created a python hier block using signal source and a VCO, but I want
be able to control parameters like amplitude, sensitivity etc il real
using sliders.

I used callback tag on xml together with the set method but it does not
work, the parameters does not seem to change at all.

is it possible to achieve what I am trying to do? how can I do it.

your help will be much appreciated.



Hi Themba,

in principle, what you describe sounds right; can you insert some ‘print
“set_foobar called”’’ in the set methods of your hier block, to check
whether they are actually being called?


Thank you Marcus for the reply.
let me show you an example of what I did. but so far i am not getting
output from it

def set_parameters(self,amplitude):
    global d_amplitude
             d_amplitude= amplitude
             print d_amplitude

#then on the contructor
def_init_(self, amplitude)
analog_sig_source = analog.sig_source_f(sampling_rate,
analog.GR_TRI_WAVE, f, d_amplitude, 0)
#then connect the block to other blocks

View this message in context:
Sent from the GnuRadio mailing list archive at

Hi Themba,

the interesting point here is where you register your callback. You say
you’ve included the callback in the .grc file; if that’s the case, you
should find it searching for the name of the variable you change using a
slider etc in the python file GRC generates.


the point is that if the print is not appearing, then the callback isn’t
working as you expect. You should really make sure to use the right
variable names.
You’re not really sharing all the interesting information; it’s a bit
hard to figure this out in what’s becoming a dialogue.
I’d like to ask you to read

Best regards,

the callback is on the .xml file from the grc folder, the parameters are
changing but the waveform is not updating.
on the other hand, all my custom blocks i get “AttributeError:
‘top_block_sptr’ object has no attribute ‘top_layout’”.

it was working all along but I just got that recently, I searched the
I havent found where there is a solution to this :frowning:

View this message in context:
Sent from the GnuRadio mailing list archive at