Saturday, April 21, 2018

Re: [Discuss-gnuradio] GRC QT widget call function upon value change?

On 04/21/2018 04:20 PM, Louis Brown wrote:
> Is there a way to make a GRC widget, such as the QT GUI Chooser, call
> a function when it changes value?
>
> I have some serial port writing functions defined in a Python Module
> block. I set the GUI Chooser options to write_serial(0),
> write_serial(1), etc.. The problem is the functions are evaluated
> only once during top_block execution, not when the Chooser value is
> changed.
>
> I have tried a Function Probe to pass the Chooser value to my
> write_serial() once a second, but the Function Probe does not update
> with the new Chooser value.
>
> Is there some trick to this?
>
> Thanks,
> Lou
>
Leverage the dependency evaluator.

Let's say your choose widget is called "foo".

Create a variable, "bar", in the value field:

your_function(foo)

Every time time that foo changes, it'll call your_function(foo), to
satisfy the dependency that "bar" has on "foo".




_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment