Wednesday, June 19, 2024

Re: Can Embedded Python Blocks have callbacks?

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEOn0gFAd3OQG8ow6EtFwrk3lBwykFAmZzQLAACgkQtFwrk3lB
wyml6Q//ZoBVFq+JBeQQrAmqwS4jE9DSKuEa6dPB7kzweVsPwxBn9tF/KCGpNQJU
ovvBv/cB4bX0gP1nJ+JtDytD8JFVg5OmiagctqluxdJPnexPwA4jAX6u9XXs4e2p
MY6KhJmUdYNVuLSR5ejoO1iwm93CRwRuQBJ5IbeizZqJoHkTTHzbbjyk+/LLCydo
E/Id0AM0SdIRAcOdh1id5WBqlius8Wnm7e5AlVUoeFx1yGMqSRTfwG3XxK9+urq/
b5Bk13C/a3TeF81BtPi6FQbXTef8uDWz7qC/r46fcRm8HfGKSzI8CJHyvTIqeIbq
BHVvD1ta0XWBLY1vU9ukZCqY8A9nsrvnqDdRYKe2Th3zijUDmWF13vqvO7T+268J
MDTC13a4qEjogvWHeg64Dq4ieWjrrdIGLvkVGHYnbFCwNraCCPOJeFedttCC0xvs
OZkbulISVAuaQnXT6ddUnH788w2gSQYp5vcd+YQOBd4LavFL5wmjulkAUZ1a3KZQ
SGqROPOK+fl4OyEEFWyBHaUsGIkdyD+M5HKnbqTtMcQXqV+I/QB3pC+T3P9dwZQh
3peGTs3i+Nrrgw4/N9du75/ryjHpxdtf18WBZ7lPTVCYkX/ziq3p2TexZDRJpbsL
215e50PHk5HicJxBzX7mBioJ3XwbEtdmYUVhKOyPAlRsIO54opc=
=dNaD
-----END PGP SIGNATURE-----
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