How to use grc item's value in py

I generated a py file by GRC with a ratiobutton block.(ratiobutton have
two
button “Yes” & “No”)
And now I want to modify the py file to implement a if logic by that
ratiobutton:
That means if user choose “Yes” then Print “XXXX”, otherwise, Print
“OOOO”,
So how and which value of ratiobutton block I should judge in py file?

Is anyone have this kind of experience before? or show me a example,
thanks

Suppose that there is a radiobutton with ID xyz:

Then, a method named “set_xyz” will be generated in the py file.
At runtime, set_xyz is called whenever the radiobutton changes.
You can add a print statement inside this set_xyz method.

_josh

Then,how to catch the value of ratiobutton block in other function or
mainloop?

That means if user choose “Yes” then set USRP freq output at
900MHz,otherwise, set USRP at 950 MHz?

2009/9/7 Josh B. [email protected]

nansai hu wrote:

Then,how to catch the value of ratiobutton block in other function or
mainloop?

Try the suggestion below and see how the generated *.py code does it.

That means if user choose “Yes” then set USRP freq output at
900MHz,otherwise, set USRP at 950 MHz?

In this case:
the radio button id should be my_usrp_freq
the radio button choices should be [900e6, 950e6]
The radio button labels should be [‘Yes’, ‘No’]

Enter the id of the radio button, my_usrp_freq, into the usrp frequency
parameter.

Then, execute the flow graph. It will work. :slight_smile:

_Josh

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs