Thursday, June 20, 2024

Re: Can Embedded Python Blocks have callbacks?

This was my concern, and it does appear to behave that way.

On Wed, Jun 19, 2024 at 4:34 PM Daniel Estévez <daniel@destevez.net> wrote:
On 19/06/2024 14:51, Jameson Collins wrote:
> I'm trying to use a callback to set a variable in an embedded python
> block.  Using the tutorial
> (https://wiki.gnuradio.org/index.php/Embedded_Python_Block
> <https://wiki.gnuradio.org/index.php/Embedded_Python_Block>) as an
> example I added the function below.  I've found that this callback never
> gets called when I update this value from a GUI.  Should it be?
>
> |def set_example_param(self, example_param): print("here")|

Hi Jameson,

I think Embedded Python blocks can only have (automatically generated)
callbacks for __init__() arguments that are assigned as

self.foo = foo

in the body of __init__() (the example template that you get when you
create a new Embedded Python block shows how this works).

If you need more complex callbacks, I think you need to create a regular
Python block in an OOT module.

Best,
Daniel.


No comments:

Post a Comment