[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Software AGC
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] Software AGC |
Date: |
Tue, 25 Jan 2005 12:39:36 -0800 |
User-agent: |
Mutt/1.5.6i |
On Tue, Jan 25, 2005 at 11:48:00AM -0500, Achilleas Anastasopoulos wrote:
> Eric,
>
> I will get to it ASAP; I can't wait to write my first
> C++ block.
Great!
> However, sometimes there is need for one block to control the gain
> of another block, which cannot be handled by this primitive.
>
> Some time ago Chuck sent a piece of code that can be modified as
>
> def build_graph (stuff) :
> fg = gr.flow_graph ()
> chan_filter = gr.fir....
> return fg, chan_filter <--- returns a tuple
>
> def main () :
> tuple = build_graph (stuff)
> tuple[0].start() <--- access 1st item in tuple
> while True:
> newtaps = ...generate the new taps
> time.sleep(5)
> tuple[1].set_taps (newtaps) <--- access 2nd item in tuple
>
> For some reason I cannot get something like this to work with
> GUI applications. Once the app.MainLoop() is invoked, the
> code that follows is not executed. Is there anything like
> the start() method in gui applications?
In gui apps, start is called on your behalf behind the scenes. You
definitely don't want to block in your gui app. Schedule a timed call
back. See wx.FutureCall or wx.Timer in the wxPython docs.
The standard wxPython demos contain a couple of examples of both.
See demo/Timer.py or samples/hangman/hangman.py
Basically you bind a handler to the wx.EVT_TIMER event, then
start a timer runing with wx.Timer. Your handler can change the
taps, or whatever when the timer fires.
Eric