Skip to content
Advertisement

GRC QT GUI Range with slider presents error

Using GNU Radio Companion 3.9.4.0.

My application has a “QT GUI Range” block. When the Widget is set to “Counter + Slider” I get the error

TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'

The Python code for this condition is,

self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)

With the Widget set to “Counter” there is no error. Now that same Python line is,

self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter", float, QtCore.Qt.Horizontal)

How can I use the desired slider?

= = =

The full error message is:

File "C:UsersUser1DocumentsRecordsSoftware Defined Radio - SDRGNU RadioFlowgraphsHackADay TutorialsVideo 02Simple_AM_Rx_01_temp.py", line 100, in __init__
    self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
  File "C:UsersUser1miniforge3envsgnuradiolibsite-packagesgnuradioqtguirange.py", line 121, in __init__
    self.d_widget = self.CounterSlider(self, self.range, self.notifyChanged, rangeType, orientation)
  File "C:UsersUser1miniforge3envsgnuradiolibsite-packagesgnuradioqtguirange.py", line 262, in __init__
    self.slider = RangeWidget.Slider(parent, ranges, self.sliderChanged, rangeType, orientation)
  File "C:UsersUser1miniforge3envsgnuradiolibsite-packagesgnuradioqtguirange.py", line 161, in __init__
    self.setRange(0, ranges.nsteps - 1)
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'

Advertisement

Answer

Your traceback shows that the file C:UsersUser1miniforge3envsgnuradiolibsite-packagesgnuradioqtguirange.py has this line:

self.setRange(0, ranges.nsteps - 1)

but when I check the repository for this project here I see

self.setRange(0, int(ranges.nsteps - 1))

They corrected a bug. You are using an outdated version of the project.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement