discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] A question on Frequency Hopping


From: 黄哲
Subject: [Discuss-gnuradio] A question on Frequency Hopping
Date: Wed, 4 Aug 2010 23:39:46 -0400

Hi all !
      I want to make a slider circling on a frequency band automatically. This is the code of original slider, a very simple slider generated by grc.

class top_block(grc_wxgui.top_block_gui):
      def __init__(self):
                grc_wxgui.top_block_gui.__init__(self, title="Top Block")

                self.variable_slider_0 = variable_slider_0 = 50
                self.samp_rate = samp_rate = 32000

                _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
                self._variable_slider_0_text_box = forms.text_box(
                        parent=self.GetWin(),
                        sizer=_variable_slider_0_sizer,
                        value=self.variable_slider_0,
                        callback=self.set_variable_slider_0,
                        label='variable_slider_0',
                        converter=forms.float_converter(),
                        proportion=0,
                )
                self._variable_slider_0_slider = forms.slider(
                        parent=self.GetWin(),
                        sizer=_variable_slider_0_sizer,
                        value=self.variable_slider_0,
                        callback=self.set_variable_slider_0,
                        label='variable_slider_0',
                        converter=forms.float_converter(),
                        proportion=0,
                )
                self._variable_slider_0_slider = forms.slider(
                        parent=self.GetWin(),
                        sizer=_variable_slider_0_sizer,
                        value=self.variable_slider_0,
                        callback=self.set_variable_slider_0,
                        minimum=0,
                        maximum=100,
                        num_steps=100,
                        style=wx.SL_HORIZONTAL,
                        cast=float,
                        proportion=1,
                )
                self.Add(_variable_slider_0_sizer)

        def set_variable_slider_0(self, variable_slider_0):
                self.variable_slider_0 = variable_slider_0
                self._variable_slider_0_slider.set_value(self.variable_slider_0)
                self._variable_slider_0_text_box.set_value(self.variable_slider_0)

        def set_samp_rate(self, samp_rate):
                self.samp_rate = samp_rate

if __name__ == '__main__':
        parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
        (options, args) = parser.parse_args()
        tb = top_block()
        tb.Run(True)

I want to make some modification on this code to make the slider can change frequency automatically and circularly. But some problems trouble me.
1) I cannot change the parameter 'value' after it is initialed. I think it controlled the freq.
2) When the tb.Run is started, I can't do anything else.

The problem 1) is the most important one. Please give me some suggestion. Thanks very much !
Best wishes for you !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]