Hi Derek, thanks a lot for your reply.
That kinda makes sense to me, but im not sure about the tutorial, it doesn't 
seem to be very explanatory.

You say that i can pass the buttons ID to the python block, but i cant seem to 
figure out how i would do that, as variables don't have outputs that i can 
connect to the block?


//Steffen


________________________________
Fra: Derek Kozel <de...@bitstovolts.com>
Sendt: 5. marts 2020 16:34
Til: Steffen Kiel <steffenk...@outlook.dk>; discuss-gnuradio@gnu.org 
<discuss-gnuradio@gnu.org>
Emne: Re: Accessing top_block from an embedded python block?

Hi Steffen,

You're missing that the embedded Python Block should work just like any other 
block. If you want to read a button state or accept a message then you'll need 
to add a parameter to the Python block and pass in the button's ID (variable) 
to it or add a message port to the block.

The Embedded Python Block tutorial does a good job covering the message side 
and adding a parameter is part of the default Python Block template.
https://wiki.gnuradio.org/index.php/Embedded_Python_Block

As a related note, in the very latest maint-3.8 and master codebases there are 
now Python Snippets for injecting Python code directly into the generated 
program. It's useful for a variety of situations, but the ones you're 
describing here are already usually handled well by the existing features.

Cheers,
Derek

On 05/03/2020 13:13, Steffen Kiel wrote:
Hello!

I am new to using GNU radio, and i would like to implement some custom features.
I would like to access functions like the get_push_button to read its state, or 
read a message box etc.
Is this even possible from the epy block?

I could also implement this directly in the top_block.py file, but my problem 
is that if i want to change something in the GUI, this file is overwritten, and 
the custom code will be erased. Or am i missing something?



Reply via email to