This is a continuation of this question. I understand that we cannot access input_items
in __init__
of a sync_block but we can do so in hier_bloc
How exactly is hier_block 's behaviour different then that of a sync_block in GNU Radio?
You should read the guided tutorials of GNU Radio where this is all explained very neatly. The content of your question has nothing to do with your title, so I'm not going to answer the question in the title.
However, your real question is a different one:
when trying to set up GUI in your work, things go wrong.
And as a continuation of the answers given you in the other thread: You don't do set up of things in the work
function. That method is only used for signal processing.
Set up your flow graph including the GUI during construction, that is, in the __init__
of your top_block
. Only that block has the graphical framework's window object set as property.
EDIT: You want to implement your own plotter:
The comment in the code where you said
# Comment 2 -> this doesnt work as Marcus says "Only init block has the graphical framework's window object set as property."
is a wrong quote. Only your top_block has access to the win property, because that's a property of that top_block (and noone else's). That's basic python you're mixing up here.
The other comment
Comment 1 -> this will not work as I dont have access to input_items here
shows that you still haven't quite understood how GNU Radio works.
There's a work function that you have to implement, and that function has a parameter input_items
; obviously, you can't access another functions parameter when you're not in that function -- that's a logical/programming language thing, too.
All I can do here is repeat: Read the guided tutorials, and do all the exercises within before trying something as complex. Otherwise, the people who try to help you have to explain basic stuff, although you have advanced problems. There's no way around getting familiar with how to program for GNU Radio in Python first, and the guided tutorials (did I mention you should read them?) make that quite easy, given that you're somewhat familiar with python. If you aren't familiar with python, go to python.org and do a python2 tutorial first. Shouldn't take long. You really need to understand the concept of classes, methods, constructors, variables, parameters, properties before you can dive into something that uses as much object-oriented paradigms as GNU Radio.
My remarks on your question: