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.
- I cannot change the parameter ‘*value’ *after it is initialed. I
think it
controlled the freq. - 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 !